Skip to main content

spawnSync

function spawnSync
Jump to headingspawnSync(command: string): SpawnSyncReturns<Buffer>

The child_process.spawnSync() method is generally identical to spawn with the exception that the function will not return until the child process has fully closed. When a timeout has been encountered and killSignal is sent, the method won't return until the process has completely exited. If the process intercepts and handles the SIGTERM signal and doesn't exit, the parent process will wait until the child process has exited.

If the shell option is enabled, do not pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution.

Parameters Jump to heading

Jump to headingcommand: string

The command to run.

Return Type Jump to heading

Jump to headingspawnSync(
command: string,
options?: SpawnSyncOptions,
): SpawnSyncReturns<string | Buffer>

Parameters Jump to heading

Jump to headingcommand: string

Return Type Jump to heading

SpawnSyncReturns<string | Buffer>
Jump to headingspawnSync(
command: string,
args: readonly string[],
): SpawnSyncReturns<Buffer>

Parameters Jump to heading

Jump to headingcommand: string
Jump to headingargs: readonly string[]

Return Type Jump to heading

Jump to headingspawnSync(
command: string,
args: readonly string[],
): SpawnSyncReturns<string>
Jump to headingspawnSync(
command: string,
args: readonly string[],
): SpawnSyncReturns<Buffer>
Jump to headingspawnSync(
command: string,
args?: readonly string[],
options?: SpawnSyncOptions,
): SpawnSyncReturns<string | Buffer>

Parameters Jump to heading

Jump to headingcommand: string
optional
Jump to headingargs: readonly string[]

Return Type Jump to heading

SpawnSyncReturns<string | Buffer>
Back to top