Home > @rushstack/node-core-library > Executable
The Executable class provides a safe, portable, recommended solution for tools that need to launch child processes.
export declare class Executable
The NodeJS child_process API provides a solution for launching child processes, however its design encourages reliance on the operating system shell for certain features. Invoking the OS shell is not safe, not portable, and generally not recommended:
Different shells have different behavior and command-line syntax, and which shell you will get with NodeJS is unpredictable. There is no universal shell guaranteed to be available on all platforms.
If a command parameter contains symbol characters, a shell may interpret them, which can introduce a security vulnerability
Each shell has different rules for escaping these symbols. On Windows, the default shell is incapable of escaping certain character sequences.
If you need additional shell features such as wildcard globbing, environment variable expansion, piping, or built-in commands, then we recommend to use the
|spawn(filename, args, options)||Start a child process.|
|spawnSync(filename, args, options)||Synchronously create a child process and optionally capture its output.|
Given a filename, this determines the absolute path of the executable file that would be executed by a shell:
- If the filename is missing a path, then the shell's default PATH will be searched. - If the filename is missing a file extension, then Windows default file extensions will be searched.