Skip to content

Commit

Permalink
service.ts: make /spawn more robust
Browse files Browse the repository at this point in the history
Prevent command from being interpreted as option by using --.
  • Loading branch information
throwaway96 committed Mar 5, 2024
1 parent 361d2cb commit acd94df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ function runService() {
service.register('spawn', (message) => {
const payload = message.payload as ExecPayload;
const respond = (event: string, args: Record<string, any>) => message.respond({ event, ...args });
const proc = child_process.spawn('/bin/sh', ['-c', payload.command]);
const proc = child_process.spawn('/bin/sh', ['-c', '--', payload.command]);
proc.stdout.on('data', (data) =>
respond('stdoutData', {
stdoutString: data.toString(),
Expand Down

0 comments on commit acd94df

Please sign in to comment.