API Reference
exec API
Learn how to run shell commands in Replit Apps using the exec API module. Includes methods for spawning processes and executing commands.
The exec
api module allows you to execute arbitrary shell commands.
Usage
Methods
exec.spawn
Spawns a command, with given arguments and environment variables. Takes in callbacks, and returns an object containing a promise that resolves when the command exits, and a dispose function to kill the process.
exec.exec
Executes a command in the shell, with given arguments and environment variables
Types
BaseSpawnOptions
Property | Type |
---|---|
args | string[] |
env? | Record<string, string> |
splitStderr? | boolean |
CombinedStderrSpawnOptions
Property | Type |
---|---|
args | string[] |
env? | Record<string, string> |
onOutput? | Function |
splitStderr? | false |
ExecResult
Property | Type |
---|---|
exitCode | number |
output | string |
SpawnOutput
Property | Type |
---|---|
dispose | Function |
resultPromise | Promise<SpawnResult> |
SpawnResult
Property | Type |
---|---|
error | null │ string |
exitCode | number |
SplitStderrSpawnOptions
Property | Type |
---|---|
args | string[] |
env? | Record<string, string> |
onStdErr? | OutputStrCallback |
onStdOut? | OutputStrCallback |
splitStderr | true |
OutputStrCallback
SpawnOptions
Was this page helpful?