import { - type CreateOSProcess,
- daemon,
- type Daemon,
- DaemonExitError,
- exec,
- type Exec,
- ExecError,
- type ExecOptions,
- type ExitStatus,
- type Process,
- type ProcessResult,
- type StdIO,
- type Writable
} from "@effectionx/process"
@effection/process
Effection is the structured concurrency toolkit for JavaScript. You can find detailed information about using effection to manage system process in node in the spawning processes guide
API Reference
Start a long-running process, like a web server that run perpetually. Daemon operations are expected to run forever, and if they exit pre-maturely before the operation containing them passes out of scope it raises an error.
Parameters
command: string
Return Type
Operation<Daemon>
Methods
join
(): Operation<ProcessResult>No documentation available.
expect
(): Operation<ProcessResult>No documentation available.
Execute command
with options
. You should use this operation for processes
that have a finite lifetime and on which you may wish to synchronize on the
exit status. If you want to start a process like a server that spins up and runs
forever, consider using daemon()
Parameters
command: string
Return Type
The process type is what is returned by the exec
operation. It has all of
standard io handles, and methods for synchronizing on return.
Properties
- pidreadonly: number
No documentation available.
Methods
join
(): Operation<ExitStatus>Completes once the process has finished regardless of whether it was successful or not.
expect
(): Operation<ExitStatus>Completes once the process has finished successfully. If the process does not complete successfully, it will raise an ExecError.
Properties
- argumentsoptional: string[]
When not using passing the
shell
option all arguments must be passed as an array.- envoptional: Record<string, string>
Map of environment variables to use for the process.
- shelloptional: boolean | string
Create an intermediate shell process; defaults to
false
. Useful if you need to handle glob expansion or passing environment variables. A truthy value will use an intermediate shell to interpret the command using the default system shell. However, if the value is a string, that will be used as the executable path for the intermediate shell.- cwdoptional: string
Sets the working directory of the process
Properties
- stdout: OutputStream
No documentation available.
- stderr: OutputStream
No documentation available.
- stdin: Writable<string>
No documentation available.
Constructors
- new ExecError(status: ExitStatus, command: string, options: ExecOptions)
Methods
- message(): string
No documentation available.