Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Command

Hierarchy

  • Command

Index

Constructors

constructor

Properties

Private delayTimeoutId

delayTimeoutId: Timeout

options

parent

parent: Command

pinger

pinger: Pinger

Private pingerHandlers

pingerHandlers: PingerHandler[] = ...

prefixCache

prefixCache: string

process

process: ChildProcess

spawnmon

spawnmon: Spawnmon

spawnmonChild

spawnmonChild: Spawnmon

stdin

stdin: Writable

subscriptions

subscriptions: Subscription[] = []

timer

Private timerHandlers

timerHandlers: SimpleTimerHandler[] = ...

Accessors

args

  • get args(): string[]

command

  • get command(): string

name

  • get name(): string

pid

  • get pid(): number

Private prepare

  • get prepare(): [string, string[], SpawnOptions]
  • Prepares options and command arguments. Ensures we're always getting the lastest. looks a mess here but simplifies options object for the user.

    Returns [string, string[], SpawnOptions]

transform

Methods

Private beforeRun

  • beforeRun(): void
  • Some preflight we can't init until right before we run.

    Returns void

child

  • Adds a new sub command.

    Parameters

    Returns Command

  • Adds the command as a sub command.

    Parameters

    • command: Command

      a command instance.

    • Optional as: string

      an alias name for the command.

    Returns Command

  • Adds a new sub command.

    Parameters

    • command: string

      the sub command to be executed.

    • Optional args: string | string[]

      the arguments to be pased.

    • Optional as: string

      an alias name for the command.

    Returns Command

  • Adds a new sub command.

    Parameters

    • command: string

      the sub command to be executed.

    • Optional args: string | string[]

      the arguments to be pased.

    • Optional options: Omit<ICommandOptions, "command" | "args">

      additional command options.

    • Optional as: string

      an alias name for the command.

    Returns Command

kill

  • kill(signal?: Signals): void
  • Kills the command if process still exists.

    Parameters

    • Optional signal: Signals

    Returns void

log

  • log(data: string | Error, shouldUpdate?: boolean, stopTimer?: boolean): void
  • Log response from subscriptions.

    Parameters

    • data: string | Error

      the data to be logged from the response.

    • shouldUpdate: boolean = true

      when true should update the timer which watches for idle commands

    • stopTimer: boolean = false

      whether to stop update timer.

    Returns void

mute

onConnect

onTimeout

run

runnable

  • runnable(state: boolean): void
  • When true calling run this command is auto runnable, when false the command name must be manually called.

    Parameters

    • state: boolean

      the auto runnable state.

    Returns void

setConnect

  • Sets the pinger options.

    Parameters

    Returns Command

  • Sets host, port and attempt options for pinger.

    Parameters

    • host: string

      the host to be pinged.

    • Optional port: number

      the host's port.

    • Optional attempts: number

      the number of atempts.

    Returns Command

setOptions

  • Sets the options object.

    Parameters

    • options: ICommandOptions

      options object to update or set to.

    • merge: boolean = true

      when true options are merged with existing.

    Returns Command

setTimeout

Private spawnCommand

Private subscribe

  • Subscribes to a child's stream.

    Parameters

    • from: EventSubscriptionType

      the stream the subscription is from.

    • input: ChildProcess | Writable | Readable

      the readable, writable stream or child process.

    • Optional transform: TransformHandler

      the transform for output.

    Returns void

unmute

unsubscribe

Private updateTimer

  • updateTimer(data: string | Error, stop?: boolean): void
  • Updates the timer issuing a new tick for the counters.

    Parameters

    • data: string | Error
    • stop: boolean = false

      when true tells timer to stop.

    Returns void

Generated using TypeDoc