fix(windows spawn): use Job Object to manage subprocesses of subprocesses
What does this PR do?
See test case, note how --watch spawns two processes, but before, the kill in the outermost process would keep the innermost subprocess alive. Now, calling kill in the outermost process kills the whole tree. This was an issue if the caller of this process tree depended on standard io, which would not be closed before. Now, since the processes are dead, the standard io is closed.
❌ @paperdave, your commit has failing tests :(
💪 2 failing tests Darwin AARCH64
test/cli/install/bun-install.test.ts1 failingtest/js/node/tls/node-tls-context.test.ts1 failing
💻 4 failing tests Darwin x64
test/cli/install/bun-create.test.ts1 failingtest/cli/install/bun-upgrade.test.ts1 failingtest/js/node/tls/node-tls-context.test.ts1 failingtest/js/web/workers/worker.test.ts1 failing
🐧💪 3 failing tests Linux AARCH64
test/cli/install/registry/bun-install-registry.test.ts3 failingtest/integration/mysql2/mysql2.test.ts2 failingtest/js/bun/http/serve.test.ts1 failing
🪟💻 8 failing tests Windows x64 baseline
test/cli/install/bun-install.test.ts41 failingtest/cli/install/bunx.test.ts2 failingtest/js/bun/shell/bunshell.test.ts1 failingtest/js/bun/spawn/spawn.test.tsSIGKILLtest/js/node/dns/node-dns.test.js2 failingtest/js/node/http/node-http.test.ts1 failingtest/js/node/process/process.test.js2 failingtest/js/node/watch/fs.watchFile.test.ts3 failing
🪟💻 9 failing tests Windows x64
test/cli/install/bunx.test.ts1 failingtest/cli/install/migration/migrate.test.ts1 failingtest/cli/install/registry/bun-install-registry.test.ts3 failingtest/integration/esbuild/esbuild.test.ts1 failingtest/js/bun/shell/bunshell.test.ts1 failingtest/js/node/dns/node-dns.test.js2 failingtest/js/node/http/node-http.test.ts1 failingtest/js/node/process/process.test.js2 failingtest/js/node/watch/fs.watchFile.test.tsSIGKILL
Changes look good now, however there seems to be a test failure in watch.test.ts on windows - I'm not sure if it was there before, but I think it wasn't
I think the hot and watch tests need to pass before this PR can be merged
these tests are definitely regressions. its a panic from failing to create the job object