Variable: shell
const shell: object;
Type declaration
assembleShellEnv()
assembleShellEnv: () => Record<string, string>;
Returns
Record
<string
, string
>
checkIfFinished()
checkIfFinished: (proc) => Promise<void>;
Logic to wait for child process to finish executing
- Check if the close event was emitted, else wait for 1 sec
- Error out if > 30 sec
Parameters
• proc: ShellProcess
Returns
Promise
<void
>
kill()
kill: (proc) => Promise<boolean>;
Parameters
• proc: ShellProcess
Returns
Promise
<boolean
>
removeANSIcolors()
removeANSIcolors: (text) => string;
Remove all the ANSI color and style encoding
Parameters
• text: string
string
Returns
string
runCommandSync()
runCommandSync: (command, shellOpts?) => string;
Run shell command synchronously
- Execute child process with the command
- Wait for the command to complete and return the standard output
Parameters
• command: string
cli command
• shellOpts?: SpawnOptionsWithoutStdio
various shell spawning options available to customize
Returns
string
command stdout
sleep()
sleep: (timeout) => Promise<void>;
Sleep function used to wait for cli to finish executing
Parameters
• timeout: number
= 1000
Returns
Promise
<void
>
spawnProcess()
spawnProcess: (command, shellOpts?) => ShellProcess;
Spawns a shell command
- Start child process with the command
- Listen to data output events and collect them
Parameters
• command: string
The command to run, e.g. echo "hi"
• shellOpts?: SpawnOptionsWithoutStdio
Options to customize shell execution
Returns
ShellProcess
command output
waitForOutput()
waitForOutput: (expString, proc, opts?) => Promise<void>;
Wait for output
Parameters
• expString: string
expected string
• proc: ShellProcess
• opts?
• opts.timeout?: number
Description
How long to wait for expected output in milliseconds. Defaults to 10 seconds.
Returns
Promise
<void
>