Module

Node.UnsafeChildProcess.Unsafe

Package
purescript-node-child-process
Repository
purescript-node/purescript-node-child-process

Exposes low-level functions for ChildProcess where JavaScript values, rather than PureScript ones, are expected.

All functions prefixed with unsafe indicate why they can be unsafe (i.e. produce a crash a runtime). All other functions are unsafe because their options (or default ones if not specified) can affect whether the unsafe* values/methods exist.

All type aliases for options (e.g. JsExecSyncOptions) are well-typed.

#unsafeSOBToString Source

unsafeSOBToString :: StringOrBuffer -> String

Same as unsafeCoerce. No runtime checking is done to ensure the value is a String.

#unsafeSOBToBuffer Source

unsafeSOBToBuffer :: StringOrBuffer -> Buffer

Same as unsafeCoerce. No runtime checking is done to ensure the value is a Buffer.

#unsafeStdin Source

unsafeStdin :: UnsafeChildProcess -> Nullable (Writable ())

Unsafe because it depends on what value was passed in via stdio[0]

#unsafeStdout Source

unsafeStdout :: UnsafeChildProcess -> Nullable (Readable ())

Unsafe because it depends on what value was passed in via stdio[1]

#unsafeStderr Source

unsafeStderr :: UnsafeChildProcess -> Nullable (Readable ())

Unsafe because it depends on what value was passed in via stdio[2]

#JsExecSyncOptions Source

type JsExecSyncOptions :: Row Typetype JsExecSyncOptions = (cwd :: String, encoding :: String, env :: Object String, gid :: Gid, input :: Buffer, killSignal :: KillSignal, maxBuffer :: Number, shell :: String, stdio :: Array StdIO, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • input <string> | <Buffer> | <TypedArray> | <DataView> The value which will be passed as stdin to the spawned process. Supplying this value will override stdio[0].
  • stdio <string> | <Array> Child's stdio configuration. stderr by default will be output to the parent process' stderr unless stdio is specified. Default: 'pipe'.
  • env <Object> Environment key-value pairs. Default: process.env.
  • shell <string> Shell to execute the command with. See Shell requirements and Default Windows shell. Default: '/bin/sh' on Unix, process.env.ComSpec on Windows.
  • uid <number> Sets the user identity of the process. (See setuid(2)).
  • gid <number> Sets the group identity of the process. (See setgid(2)).
  • timeout <number> In milliseconds the maximum amount of time the process is allowed to run. Default: undefined.
  • killSignal <string> | <integer> The signal value to be used when the spawned process will be killed. Default: 'SIGTERM'.
  • maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.
  • encoding <string> The encoding used for all stdio inputs and outputs. Default: 'buffer'.
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.

#execSync' Source

execSync' :: forall r trash. Union r trash JsExecSyncOptions => String -> Record r -> Effect StringOrBuffer

#JsExecOptions Source

type JsExecOptions :: Row Typetype JsExecOptions = (cwd :: String, encoding :: String, env :: Object String, gid :: Gid, killSignal :: KillSignal, maxBuffer :: Number, shell :: Shell, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • env <Object> Environment key-value pairs. Default: process.env.
  • encoding <string> Default: 'utf8'
  • timeout <number> Default: 0
  • maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.
  • killSignal <string> | <integer> Default: 'SIGTERM'
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.
  • shell <boolean> | <string> If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string. See Shell requirements and Default Windows shell. Default: false (no shell).

#execOpts Source

execOpts :: forall r trash. Union r trash JsExecOptions => String -> Record r -> Effect UnsafeChildProcess

#JsExecFileSyncOptions Source

type JsExecFileSyncOptions :: Row Typetype JsExecFileSyncOptions = (cwd :: String, encoding :: String, env :: Object String, gid :: Gid, input :: Buffer, killSignal :: KillSignal, maxBuffer :: Number, shell :: Shell, stdio :: Array StdIO, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • input <string> | <Buffer> | <TypedArray> | <DataView> The value which will be passed as stdin to the spawned process. Supplying this value will override stdio[0].
  • stdio <string> | <Array> Child's stdio configuration. stderr by default will be output to the parent process' stderr unless stdio is specified. Default: 'pipe'.
  • env <Object> Environment key-value pairs. Default: process.env.
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • timeout <number> In milliseconds the maximum amount of time the process is allowed to run. Default: undefined.
  • killSignal <string> | <integer> The signal value to be used when the spawned process will be killed. Default: 'SIGTERM'.
  • maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.
  • encoding <string> The encoding used for all stdio inputs and outputs. Default: 'buffer'.
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.
  • shell <boolean> | <string> If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string. See Shell requirements and Default Windows shell. Default: false (no shell).

#execFileSync' Source

#JsExecFileOptions Source

type JsExecFileOptions :: Row Typetype JsExecFileOptions = (cwd :: String, encoding :: String, env :: Object String, gid :: Gid, killSignal :: KillSignal, maxBuffer :: Number, shell :: Shell, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean, windowsVerbatimArguments :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • env <Object> Environment key-value pairs. Default: process.env.
  • encoding <string> Default: 'utf8'
  • timeout <number> Default: 0
  • maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.
  • killSignal <string> | <integer> Default: 'SIGTERM'
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.
  • windowsVerbatimArguments <boolean> No quoting or escaping of arguments is done on Windows. Ignored on Unix. Default: false.
  • shell <boolean> | <string> If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string. See Shell requirements and Default Windows shell. Default: false (no shell).

#execFileOpts Source

#JsSpawnSyncResult Source

type JsSpawnSyncResult = { error :: Nullable SystemError, output :: Array Foreign, pid :: Pid, signal :: Nullable KillSignal, status :: Nullable Int, stderr :: StringOrBuffer, stdout :: StringOrBuffer }

#JsSpawnSyncOptions Source

type JsSpawnSyncOptions :: Row Typetype JsSpawnSyncOptions = (argv0 :: String, cwd :: String, encoding :: String, env :: Object String, gid :: Gid, input :: Buffer, killSignal :: KillSignal, maxBuffer :: Number, shell :: Shell, stdio :: Array StdIO, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean, windowsVerbatimArguments :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • input <string> | <Buffer> | <TypedArray> | <DataView> The value which will be passed as stdin to the spawned process. Supplying this value will override stdio[0].
  • argv0 <string> Explicitly set the value of argv[0] sent to the child process. This will be set to command if not specified.
  • stdio <string> | <Array> Child's stdio configuration.
  • env <Object> Environment key-value pairs. Default: process.env.
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • timeout <number> In milliseconds the maximum amount of time the process is allowed to run. Default: undefined.
  • killSignal <string> | <integer> The signal value to be used when the spawned process will be killed. Default: 'SIGTERM'.
  • maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.
  • encoding <string> The encoding used for all stdio inputs and outputs. Default: 'buffer'.
  • shell <boolean> | <string> If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string. See Shell requirements and Default Windows shell. Default: false (no shell).
  • windowsVerbatimArguments <boolean> No quoting or escaping of arguments is done on Windows. Ignored on Unix. This is set to true automatically when shell is specified and is CMD. Default: false.
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.

#spawnSync' Source

#JsSpawnOptions Source

type JsSpawnOptions :: Row Typetype JsSpawnOptions = (argv0 :: String, cwd :: String, detached :: Boolean, env :: Object String, gid :: Gid, killSignal :: KillSignal, serialization :: String, shell :: Shell, stdio :: Array StdIO, timeout :: Milliseconds, uid :: Uid, windowsHide :: Boolean, windowsVerbatimArguments :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • env <Object> Environment key-value pairs. Default: process.env.
  • argv0 <string> Explicitly set the value of argv[0] sent to the child process. This will be set to command if not specified.
  • stdio <Array> | <string> Child's stdio configuration (see options.stdio).
  • detached <boolean> Prepare child to run independently of its parent process. Specific behavior depends on the platform, see options.detached).
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • serialization <string> Specify the kind of serialization used for sending messages between processes. Possible values are 'json' and 'advanced'. See Advanced serialization for more details. Default: 'json'.
  • shell <boolean> | <string> If true, runs command inside of a shell. Uses '/bin/sh' on Unix, and process.env.ComSpec on Windows. A different shell can be specified as a string. See Shell requirements and Default Windows shell. Default: false (no shell).
  • windowsVerbatimArguments <boolean> No quoting or escaping of arguments is done on Windows. Ignored on Unix. This is set to true automatically when shell is specified and is CMD. Default: false.
  • windowsHide <boolean> Hide the subprocess console window that would normally be created on Windows systems. Default: false.
  • signal <AbortSignal> allows aborting the child process using an AbortSignal.
  • timeout <number> In milliseconds the maximum amount of time the process is allowed to run. Default: undefined.
  • killSignal <string> | <integer> The signal value to be used when the spawned process will be killed by timeout or abort signal. Default: 'SIGTERM'.

#spawn' Source

spawn' :: forall r trash. Union r trash JsSpawnOptions => String -> Array String -> Record r -> Effect UnsafeChildProcess

#JsForkOptions Source

type JsForkOptions :: Row Typetype JsForkOptions = (cwd :: String, detached :: Boolean, env :: Object String, execArgv :: Array String, execPath :: String, gid :: Gid, killSignal :: KillSignal, serialization :: String, silent :: Boolean, stdio :: Array StdIO, timeout :: Milliseconds, uid :: Uid, windowsVerbatimArguments :: Boolean)
  • cwd <string> | <URL> Current working directory of the child process.
  • detached <boolean> Prepare child to run independently of its parent process. Specific behavior depends on the platform, see options.detached).
  • env <Object> Environment key-value pairs. Default: process.env.
  • execPath <string> Executable used to create the child process.
  • execArgv <string[]> List of string arguments passed to the executable. Default: process.execArgv.
  • gid <number> Sets the group identity of the process (see setgid(2)).
  • serialization <string> Specify the kind of serialization used for sending messages between processes. Possible values are 'json' and 'advanced'. See Advanced serialization for more details. Default: 'json'.
  • signal <AbortSignal> Allows closing the child process using an AbortSignal.
  • killSignal <string> | <integer> The signal value to be used when the spawned process will be killed by timeout or abort signal. Default: 'SIGTERM'.
  • silent <boolean> If true, stdin, stdout, and stderr of the child will be piped to the parent, otherwise they will be inherited from the parent, see the 'pipe' and 'inherit' options for child_process.spawn()'s stdio for more details. Default: false.
  • stdio <Array> | <string> See child_process.spawn()'s stdio. When this option is provided, it overrides silent. If the array variant is used, it must contain exactly one item with value 'ipc' or an error will be thrown. For instance [0, 1, 2, 'ipc'].
  • uid <number> Sets the user identity of the process (see setuid(2)).
  • windowsVerbatimArguments <boolean> No quoting or escaping of arguments is done on Windows. Ignored on Unix. Default: false.
  • timeout <number> In milliseconds the maximum amount of time the process is allowed to run. Default: undefined.

#fork' Source

fork' :: forall r trash. Union r trash JsForkOptions => String -> Array String -> Record r -> Effect UnsafeChildProcess

#unsafeSend Source

unsafeSend :: forall messageRows. Record messageRows -> Nullable Handle -> UnsafeChildProcess -> Effect Boolean

Unsafe because child process must be a Node child process and an IPC channel must exist.

#JsSendOptions Source

type JsSendOptions :: Row Typetype JsSendOptions = (keepAlive :: Boolean)
  • keepAlive <boolean> A value that can be used when passing instances of net.Socket as the Handle. When true, the socket is kept open in the sending process. Default: false.

#unsafeSendOpts Source

unsafeSendOpts :: forall r trash messageRows. Union r trash JsSendOptions => Record messageRows -> Nullable Handle -> Record r -> UnsafeChildProcess -> Effect Boolean

Unsafe because child process must be a Node child process and an IPC channel must exist.

#unsafeSendCb Source

unsafeSendCb :: forall messageRows. Record messageRows -> Nullable Handle -> (Maybe Error -> Effect Unit) -> UnsafeChildProcess -> Effect Boolean

Unsafe because child process must be a Node child process and an IPC channel must exist.

#unsafeSendOptsCb Source

unsafeSendOptsCb :: forall r trash messageRows. Union r trash JsSendOptions => Record messageRows -> Nullable Handle -> Record r -> (Maybe Error -> Effect Unit) -> UnsafeChildProcess -> Effect Boolean

Unsafe because child process must be a Node child process and an IPC channel must exist.

#unsafeChannelRef Source

unsafeChannelRef :: UnsafeChildProcess -> Effect Unit

Unsafe because it depends on whether an IPC channel exists.

#unsafeChannelUnref Source

unsafeChannelUnref :: UnsafeChildProcess -> Effect Unit

Unsafe because it depends on whether an IPC channel exists.