Skip to content

Commit

Permalink
fix(command-dev): ensure no orphaned child process on Windows (#3278)
Browse files Browse the repository at this point in the history
`execa` defaults to `windowsHide: true`, which prevents child processes
from terminating child processes on exit [1].

Let's set `windowsHide: false` to terminate child processes properly on
exit.

[1]: sindresorhus/execa#433
  • Loading branch information
Xenonym authored Aug 31, 2021
1 parent 4f4388b commit ef396b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ const startFrameworkServer = async function ({ settings, exit }) {
log(`${NETLIFYDEVLOG} Starting Netlify Dev with ${settings.framework || 'custom config'}`)

// we use reject=false to avoid rejecting synchronously when the command doesn't exist
const frameworkProcess = execa.command(settings.command, { preferLocal: true, reject: false, env: settings.env })
const frameworkProcess = execa.command(settings.command, {
preferLocal: true,
reject: false,
env: settings.env,
// windowsHide needs to be false for child process to terminate properly on Windows
windowsHide: false,
})
frameworkProcess.stdout.pipe(stripAnsiCc.stream()).pipe(process.stdout)
frameworkProcess.stderr.pipe(stripAnsiCc.stream()).pipe(process.stderr)
process.stdin.pipe(frameworkProcess.stdin)
Expand Down

1 comment on commit ef396b2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 327 MB

Please sign in to comment.