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
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
execute()
execute(
input:string|VirtualFile,io?:Partial<ProcessIO>):Promise<number>
Parses and executes a shell script.
Parameters
input
string | VirtualFile
The script content or a virtual file.
io?
Optional output streams to override default TTY behavior.
Returns
Promise<number>
The exit code of the last command executed in the script.
evaluateArithmetic()
evaluateArithmetic(
node:ArithmeticNode,env:ShellEnvironment):number
Evaluates an arithmetic expression using an ArithmeticParser and returns an exit code.
Parameters
node
The arithmetic operation.
env
The ShellEnvironment used for variable resolution within this instance.
Returns
number
EXIT_CODE.success if the ArithmeticParserResult is successful and non-zero, or EXIT_CODE.generalError otherwise.
evaluatePrompt()
evaluatePrompt(
format:string,env?:ShellEnvironment):Promise<string>
Evaluates a prompt string by resolving escape sequences and shell expansions.
Parameters
format
string
env?
ShellEnvironment = ...
Returns
Promise<string>