UNPKG

just-scripts

Version:
37 lines 1.98 kB
/// <reference types="node" /> import * as cp from 'child_process'; /** * @deprecated This prevents issues from spaces in args, but does NOT escape shell metacharacters. * For full escaping, consider a library such as `shell-quote` instead. (Note that `spawn` and tasks * from this package now use `cross-spawn` which escapes spaces internally.) */ export declare function encodeArgs(cmdArgs: string[]): string[]; /** * Log `Running: <process.execPath> <...args>` */ export declare function logNodeCommand(...args: (string | string[])[]): void; /** * Execute a command in a new process. Uses `cross-spawn` to avoid issues with spaces in arguments, * but does not do any additional escaping. (For further enhancements, consider using the `execa` * library instead.) * * **WARNING: If the `shell` option is enabled, do not pass unsanitized user input to this function. * Any input containing shell metacharacters may be used to trigger arbitrary command execution.** * * @param cmd Command to execute * @param args Args for the command. Quoting spaces is handled internally by `cross-spawn`. * @param opts Normal spawn options plus stdout/stderr for piping output. (To inherit stdio from the * parent process, just use `stdio: 'inherit'` instead.) * * @returns Promise which will settle when the command completes. If the promise is rejected, the error will * include the child process's exit code (`error.code`) or signal (`error.signal`) if relevant. * The returned promise also has a `child` property with the spawned `ChildProcess` instance. * * @deprecated This function is not recommended for use outside the `just-scripts` package. * Instead, consider a more mature, purpose-specific library such as `execa` or `nano-spawn`. */ export declare function spawn(cmd: string, args?: ReadonlyArray<string>, opts?: cp.SpawnOptions & { stdout?: NodeJS.WritableStream; stderr?: NodeJS.WritableStream; }): Promise<void>; //# sourceMappingURL=exec.d.ts.map