Class ShellInterpreter
Source: shellInterpreter.ts
Handles the parsing, expansion, and execution of shell commands and scripts. Manages the process pipeline and stream redirection.
Constructors
Constructor
new ShellInterpreter(
shell:Shell):ShellInterpreter
Parameters
shell
Returns
ShellInterpreter
Properties
pipeline
pipeline:
Process[] =[]
Methods
terminatePipeline()
terminatePipeline(
signal:StreamSignal):void
Sends a termination signal to all processes currently in the pipeline.
Parameters
signal
The signal to send.
Returns
void
executeScript()
executeScript(
script:string|VirtualFile):Promise<number>
Parses and executes a shell script.
Parameters
script
The script content or a virtual file.
string | VirtualFile
Returns
Promise<number>
The exit code of the last command executed in the script.
execute()
execute(
input:string,streams?: {stdout?:Stream<string>;stderr?:Stream<string>; }):Promise<number>
Parses and executes an input string, handling environment expansion and piping.
Parameters
input
string
The raw command line string.
streams?
Optional output streams to override default TTY behavior.
stdout?
Stream<string>
stderr?
Stream<string>
Returns
Promise<number>
A promise that resolves with the final exit code of the execution.
spawn()
Resolves a command, parses flags/options, and executes the command logic.
Parameters
__namedParameters
Returns
Promise<number>
The resulting exit code from the command execution.
parseCommand()
staticparseCommand(input:string):string[]
Splits a command string into an array of arguments, respecting single and double quotes.
Parameters
input
string
Returns
string[]