Package-level declarations

Types

Link copied to clipboard
open external class ChildProcess : EventEmitter

Instances of the ChildProcess represent spawned child processes.

Link copied to clipboard
sealed external interface ChildProcessByStdio<I : Writable?, O : Readable?, E : Readable?> : ChildProcess
Link copied to clipboard
sealed external interface ChildProcessWithoutNullStreams : ChildProcess
Link copied to clipboard
sealed external interface CommonExecOptions : CommonOptions
Link copied to clipboard
sealed external interface CommonOptions : ProcessEnvOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface ExecBufferOptions : ExecOptions
Link copied to clipboard
sealed external interface ExecException : Throwable
Link copied to clipboard
sealed external interface ExecFileException : ExecException, ErrnoException
Link copied to clipboard
sealed external interface ExecFileOptions : CommonOptions, Abortable
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed external interface ExecFileSyncOptions : CommonExecOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface ExecOptions : CommonOptions
Link copied to clipboard
sealed external interface ExecOptionsWithBufferEncoding : ExecOptions
Link copied to clipboard
sealed external interface ExecOptionsWithStringEncoding : ExecOptions
Link copied to clipboard
sealed external interface ExecStringOptions : ExecOptions
Link copied to clipboard
sealed external interface ExecSyncOptions : CommonExecOptions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed external interface IOType
Link copied to clipboard
sealed external interface MessageOptions
Link copied to clipboard
sealed external interface MessagingOptions : Abortable
Link copied to clipboard
sealed external interface ProcessEnvOptions
Link copied to clipboard
sealed external interface PromiseWithChild<T> : Promise<T>
Link copied to clipboard
typealias SendHandle = Any?
Link copied to clipboard
typealias Serializable = Any
Link copied to clipboard
sealed external interface SerializationType
Link copied to clipboard
sealed external interface SpawnOptions : CommonSpawnOptions
Link copied to clipboard
sealed external interface SpawnOptionsWithoutStdio : SpawnOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface SpawnSyncOptions : CommonSpawnOptions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed external interface SpawnSyncReturns<T>
Link copied to clipboard
typealias StdioNull = Any
Link copied to clipboard
typealias StdioOptions = Any
Link copied to clipboard
Link copied to clipboard
sealed external interface StdioPipeNamed

Functions

Link copied to clipboard
external fun exec(command: String, callback: (error: ExecException?, stdout: String, stderr: String) -> Unit = definedExternally): ChildProcess

Spawns a shell then executes the command within that shell, buffering any generated output. The command string passed to the exec function is processed directly by the shell and special characters (vary based on shell) need to be dealt with accordingly:

external fun exec(command: String, options: ExecStringOptions): ChildProcess
external fun exec(command: String, options: ExecBufferOptions, callback: (error: ExecException?, stdout: Buffer, stderr: Buffer) -> Unit = definedExternally): ChildProcess
external fun exec(command: String, options: ExecObjectEncodingOptions?, callback: (error: ExecException?, stdout: Any, stderr: Any) -> Unit = definedExternally): ChildProcess
external fun exec(command: String, options: ExecOptions, callback: (error: ExecException?, stdout: String, stderr: String) -> Unit = definedExternally): ChildProcess
external fun exec(command: String, options: ExecStringOptions, callback: (error: ExecException?, stdout: Any, stderr: Any) -> Unit = definedExternally): ChildProcess
external fun exec(command: String, options: ExecStringOptions, callback: (error: ExecException?, stdout: String, stderr: String) -> Unit = definedExternally): ChildProcess
Link copied to clipboard
external fun execFile(file: String): ChildProcess

The child_process.execFile() function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified executable file is spawned directly as a new process making it slightly more efficient than {@link exec}.

external fun execFile(file: String, args: ReadonlyArray<String>? = definedExternally): ChildProcess
external fun execFile(file: String, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
external fun execFile(file: String, options: ExecFileObjectEncodingOptions?, callback: (error: ExecFileException?, stdout: Any, stderr: Any) -> Unit?): ChildProcess
external fun execFile(file: String, options: ExecFileOptions, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
external fun execFile(file: String, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException?, stdout: Buffer, stderr: Buffer) -> Unit): ChildProcess
external fun execFile(file: String, options: ExecFileOptionsWithOtherEncoding, callback: (error: ExecFileException?, stdout: Any, stderr: Any) -> Unit): ChildProcess
external fun execFile(file: String, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, options: ExecFileObjectEncodingOptions?, callback: (error: ExecFileException?, stdout: Any, stderr: Any) -> Unit?): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, options: ExecFileOptions, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException?, stdout: Buffer, stderr: Buffer) -> Unit): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, options: ExecFileOptionsWithOtherEncoding, callback: (error: ExecFileException?, stdout: Any, stderr: Any) -> Unit): ChildProcess
external fun execFile(file: String, args: ReadonlyArray<String>?, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException?, stdout: String, stderr: String) -> Unit): ChildProcess
Link copied to clipboard
external fun execFileSync(file: String): Buffer

The child_process.execFileSync() method is generally identical to {@link execFile} with the exception that the method 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.

external fun execFileSync(file: String, args: ReadonlyArray<String>): Buffer
external fun execFileSync(file: String, options: ExecFileSyncOptions = definedExternally): Any
external fun execFileSync(file: String, args: ReadonlyArray<String> = definedExternally, options: ExecFileSyncOptions = definedExternally): Any
Link copied to clipboard
external fun execSync(command: String): Buffer

The child_process.execSync() method is generally identical to {@link exec} with the exception that the method 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 child process intercepts and handles the SIGTERM signal and doesn't exit, the parent process will wait until the child process has exited.

external fun execSync(command: String, options: ExecSyncOptions = definedExternally): Any
external fun execSync(command: String, options: ExecSyncOptionsWithBufferEncoding): Buffer
external fun execSync(command: String, options: ExecSyncOptionsWithStringEncoding): String
Link copied to clipboard
external fun fork(modulePath: String): ChildProcess
external fun fork(modulePath: String, args: ReadonlyArray<String> = definedExternally, options: ForkOptions = definedExternally): ChildProcess
external fun fork(modulePath: URL, args: ReadonlyArray<String> = definedExternally, options: ForkOptions = definedExternally): ChildProcess

external fun fork(modulePath: URL): ChildProcess
external fun fork(modulePath: String, options: ForkOptions = definedExternally): ChildProcess
external fun fork(modulePath: URL, options: ForkOptions = definedExternally): ChildProcess

The child_process.fork() method is a special case of {@link spawn} used specifically to spawn new Node.js processes. Like {@link spawn}, a ChildProcess object is returned. The returned ChildProcess will have an additional communication channel built-in that allows messages to be passed back and forth between the parent and child. See subprocess.send() for details.

Link copied to clipboard
external fun spawn(command: String, options: SpawnOptions): ChildProcess
external fun spawn(command: String, args: ReadonlyArray<String>, options: SpawnOptions): ChildProcess
external fun spawn(command: String, args: ReadonlyArray<String> = definedExternally, options: SpawnOptionsWithoutStdio = definedExternally): ChildProcessWithoutNullStreams

external fun spawn(command: String, options: SpawnOptionsWithoutStdio = definedExternally): ChildProcessWithoutNullStreams

The child_process.spawn() method spawns a new process using the given command, with command-line arguments in args. If omitted, args defaults to an empty array.

Link copied to clipboard
external fun spawnSync(command: String): SpawnSyncReturns<Buffer>

The child_process.spawnSync() method is generally identical to {@link 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.

external fun spawnSync(command: String, args: ReadonlyArray<String>): SpawnSyncReturns<Buffer>
external fun spawnSync(command: String, options: SpawnSyncOptions = definedExternally): SpawnSyncReturns<Any>
external fun spawnSync(command: String, args: ReadonlyArray<String> = definedExternally, options: SpawnSyncOptions = definedExternally): SpawnSyncReturns<Any>