Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/util/spawn"

Index

Type aliases

ErrorFinder

ErrorFinder: function

Type that can react to the exit of a spawned child process, after Node has terminated without reporting an error. This is necessary only for commands that can return a non-zero exit code on success.

returns

whether this result should be considered an error.

deprecated

use @atomist/sdm version

Type declaration

    • (code: number, signal: string, log: WritableLog): boolean
    • Parameters

      Returns boolean

Functions

Const SuccessIsReturn0ErrorFinder

  • SuccessIsReturn0ErrorFinder(code: number): boolean
  • Default ErrorFinder that regards return code 0 as success

    Parameters

    • code: number

    Returns boolean

asSpawnCommand

  • asSpawnCommand(sentence: string, options?: SpawnOptions): SpawnCommand
  • Convenience function to create a spawn command from a sentence such as "npm run compile" Does not respect quoted arguments. Use spawnAndWatch passing it the command and argument array if your command arguments have spaces, etc.

    deprecated

    just pass the proper arguments to @atomist/sdm spawnAndLog

    Parameters

    • sentence: string

      command and argument string

    • Default value options: SpawnOptions = {}

    Returns SpawnCommand

clearAndReject

  • clearAndReject(pid: number, reject: function, ...timers: Timer[]): function
  • Clear provided timers and reject a promise.

    deprecated

    not used by spawnPromise

    Parameters

    • pid: number
    • reject: function
        • (e: Error): void
        • Parameters

          • e: Error

          Returns void

    • Rest ...timers: Timer[]

    Returns function

      • (reason: Error): void
      • Parameters

        • reason: Error

        Returns void

clearAndResolve

  • clearAndResolve(pid: number, resolve: function, ...timers: Timer[]): function
  • Clear provided timers and resolve a promise.

    deprecated

    not used by spawnPromise

    Parameters

    • pid: number
    • resolve: function
        • (): void
        • Returns void

    • Rest ...timers: Timer[]

    Returns function

      • (code: number, signal: string): void
      • Parameters

        • code: number
        • signal: string

        Returns void

clearTimers

  • clearTimers(timers: Timer[]): void
  • Clear provided timers. It checks to make sure the timers are defined before clearing them.

    deprecated

    only used by deprecated functions

    Parameters

    • timers: Timer[]

      the timers to clear.

    Returns void

crossKill

  • crossKill(cp: ChildProcess, signal?: string): void
  • Cross-platform kill. On win32, tree-kill is used and signal is ignored since win32 does not support different signals. On other platforms, ChildProcess.kill(signal) is used.

    deprecated

    use killProcess

    Parameters

    • cp: ChildProcess

      child process to kill

    • Optional signal: string

      optional signal, Node.js default is used if not provided

    Returns void

poisonAndWait

  • poisonAndWait(childProcess: ChildProcess, wait?: number): Promise<void>
  • Kill the child process and wait for it to shut down. This can take a while as child processes may have shut down hooks. On win32, tree-kill is used and the Promise is rejected if the process(es) do(es) not exit within wait milliseconds. On other platforms, first the child process is sent the default signal, SIGTERM. After wait milliseconds, it is sent SIGKILL. After another wait milliseconds, an error is thrown.

    deprecated

    use @atomist/sdm killAndWait

    Parameters

    • childProcess: ChildProcess
    • Default value wait: number = 30000

      the number of milliseconds to wait before sending SIGKILL and then erroring, default is 30000 ms

    Returns Promise<void>

spawnAndWatch

  • Spawn a process, log its output, and wait for it to exit, asynchronously. It is spawned using cross-spawn.

    deprecated

    use @atomist/sdm spawnAndLog

    Parameters

    Returns Promise<ChildProcessResult>

stringifySpawnCommand

watchSpawned

Generated using TypeDoc