Skip to content

Commit

Permalink
feat: let detached opt be configurable
Browse files Browse the repository at this point in the history
closes google#781
  • Loading branch information
antongolub committed Apr 17, 2024
1 parent d397293 commit 0e821b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface Options {
postfix: string
quote: typeof quote
quiet: boolean
detached: boolean
spawn: typeof spawn
spawnSync: typeof spawnSync
log: typeof log
Expand All @@ -89,6 +90,8 @@ export function syncProcessCwd(flag: boolean = true) {
else cwdSyncHook.disable()
}

const isWin = process.platform == 'win32'

export const defaults: Options = {
[processCwd]: process.cwd(),
[syncExec]: false,
Expand All @@ -102,12 +105,12 @@ export const defaults: Options = {
prefix: '',
postfix: '',
quote: noquote,
detached: !isWin,
spawn,
spawnSync,
log,
kill,
}
const isWin = process.platform == 'win32'

export function usePowerShell() {
$.shell = which.sync('powershell.exe')
Expand Down Expand Up @@ -256,7 +259,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
spawnSync: $.spawnSync,
stdio: self._stdio ?? $.stdio,
sync: $[syncExec],
detached: !isWin,
detached: $.detached,
run: (cb) => cb(),
on: {
start: () => {
Expand Down

0 comments on commit 0e821b9

Please sign in to comment.