microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.43k stars 232 forks source link

How to listen the finish event or state of a command execution? #542

Closed mexhfl closed 2 years ago

mexhfl commented 2 years ago

Environment details

Issue description

Tyriar commented 2 years ago

You can't without some form of shell integration (not an easy problem) or by running a one and done command like bash -c "yourcommand"

deflexable commented 4 months ago

can you explain more on how bash -c "yourcommand" enable you detect when a command execution has completed

Tyriar commented 4 months ago

@deflexable spawn('bash') will open an interactive bash shell, spawn('bash', ['-c', 'yourcommand']) will run yourcommand and then exit.