Skip to content

Commit 3cf7736

Browse files
committed
fix: set datached opt to false by default
1 parent 0e821b9 commit 3cf7736

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/core.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ export function syncProcessCwd(flag: boolean = true) {
9090
else cwdSyncHook.disable()
9191
}
9292

93-
const isWin = process.platform == 'win32'
94-
9593
export const defaults: Options = {
9694
[processCwd]: process.cwd(),
9795
[syncExec]: false,
@@ -105,7 +103,7 @@ export const defaults: Options = {
105103
prefix: '',
106104
postfix: '',
107105
quote: noquote,
108-
detached: !isWin,
106+
detached: false,
109107
spawn,
110108
spawnSync,
111109
log,

test/core.test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ describe('core', () => {
318318
})
319319

320320
test('abort() method works', async () => {
321-
const p = $`sleep 9999`
321+
const p = $({ detached: true })`sleep 999`
322322
setTimeout(() => p.abort(), 100)
323323

324324
try {
@@ -331,7 +331,7 @@ describe('core', () => {
331331

332332
test('accepts optional AbortController', async () => {
333333
const ac = new AbortController()
334-
const p = $({ ac })`sleep 9999`
334+
const p = $({ ac, detached: true })`sleep 999`
335335
setTimeout(() => ac.abort(), 100)
336336

337337
try {
@@ -345,7 +345,7 @@ describe('core', () => {
345345
test('accepts AbortController `signal` separately', async () => {
346346
const ac = new AbortController()
347347
const signal = ac.signal
348-
const p = $({ signal })`sleep 9999`
348+
const p = $({ signal, detached: true })`sleep 999`
349349
setTimeout(() => ac.abort(), 100)
350350

351351
try {
@@ -357,7 +357,7 @@ describe('core', () => {
357357
})
358358

359359
test('kill() method works', async () => {
360-
let p = $`sleep 9999`.nothrow()
360+
let p = $`sleep 999`.nothrow()
361361
setTimeout(() => {
362362
p.kill()
363363
}, 100)
@@ -471,7 +471,7 @@ describe('core', () => {
471471
test('timeout() works', async () => {
472472
let exitCode, signal
473473
try {
474-
await $`sleep 9999`.timeout(10, 'SIGKILL')
474+
await $`sleep 999`.timeout(10, 'SIGKILL')
475475
} catch (p) {
476476
exitCode = p.exitCode
477477
signal = p.signal

0 commit comments

Comments
 (0)