Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent d57620d commit 7ba6e65
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/run/process/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const spawnRunnerProcess = async function ({
combination: {
dimensions: {
runner: {
id,
spawn: [file, ...args],
spawnOptions,
},
Expand All @@ -44,20 +45,25 @@ export const spawnRunnerProcess = async function ({
serverUrl,
logsStream,
}) {
const childProcess = spawnProcess(
[file, ...args, serverUrl],
{
...spawnOptions,
stdio: getStdio(logsStream),
reject: false,
detached: true,
cleanup: true,
},
cwd,
)
await waitForIpcSetup(childProcess, server)
const onTaskExit = noUnhandledRejection(throwOnTaskExit(childProcess))
return { childProcess, onTaskExit }
try {
const childProcess = spawnProcess(
[file, ...args, serverUrl],
{
...spawnOptions,
stdio: getStdio(logsStream),
reject: false,
detached: true,
cleanup: true,
},
cwd,
)
await waitForIpcSetup(childProcess, server)
const onTaskExit = noUnhandledRejection(throwOnTaskExit(childProcess))
return { childProcess, onTaskExit }
} catch (error) {
error.message = `In runner "${id}":\n${error.message}`
throw error
}
}

// The `dev` command directly streams stdout/stderr.
Expand Down

0 comments on commit 7ba6e65

Please sign in to comment.