Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions packages/openops/src/lib/command-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,31 @@ async function getResult(childProcess: ChildProcess, fullCommand: string) {
stdout += data;
});

const exitCode = await new Promise<number>((resolve) => {
childProcess.on('close', (code: number) => {
resolve(code);
});
const result = await new Promise<{
exitCode: number;
signal: NodeJS.Signals | null;
}>((resolve) => {
childProcess.on(
'close',
(exitCode: number, signal: NodeJS.Signals | null) => {
resolve({ exitCode, signal });
},
Comment thread
MarceloRGonc marked this conversation as resolved.
);
});

logger.debug('Command exited', {
command: fullCommand,
exitCode,
stdout,
errorMessage,
command: fullCommand,
pid: childProcess.pid,
signal: result.signal,
exitCode: result.exitCode,
stdoutBytes: Buffer.byteLength(stdout),
stderrBytes: Buffer.byteLength(errorMessage),
});

return {
exitCode: exitCode,
exitCode: result.exitCode,
stdOut: trimNewLines(stdout),
stdError: trimNewLines(errorMessage),
};
Expand Down
Loading