@j-o-r/sh 1.1.28 → 1.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/SH.d.ts CHANGED
@@ -1,198 +1,220 @@
1
+ /**
2
+ * Parsed command-line arguments.
3
+ *
4
+ * Named options map to their string value, or `true` when no value is supplied.
5
+ * Bare positional arguments are collected in `_`.
6
+ */
1
7
  export type ArgsObject = {
2
- [x: string]: string;
8
+ _: string[];
9
+ } & {
10
+ [x: string]: string | true | string[];
3
11
  };
4
12
  export type RejectCallback = Function;
5
13
  export type ResolveCallback = Function;
14
+ export type SHOptions = import("./SHDispatch.js").SHOptions;
15
+ export type AbortableInput = {
16
+ /**
17
+ * - Promise that resolves to user input or void if aborted.
18
+ */
19
+ input: Promise<string | void>;
20
+ /**
21
+ * - Function to abort input collection.
22
+ */
23
+ abort: () => void;
24
+ };
25
+ /**
26
+ * Generator-like object that yields retry delay durations.
27
+ */
28
+ export type ExpBackoffGenerator = Iterator<number | string>;
6
29
  /**
7
- * Creates a new SHDispatch object that represents a command to be executed.
30
+ * Template tag for building and executing shell commands.
31
+ *
32
+ * Returns an {@link SHDispatch} instance for configuration (.options()) and execution (.run(), .runSync()).
33
+ *
34
+ * Interpolation rules are raw-by-default:
35
+ * - Arrays: Each element is converted with `String(value)` and joined with one space.
36
+ * - Other values: `String(value)` is inserted directly into the shell source.
37
+ *
38
+ * Raw interpolation allows trusted shell fragments such as pipes, redirects, and
39
+ * command separators. It is not safe for untrusted input. Wrap untrusted values
40
+ * with {@link bashEscape} before interpolating them.
41
+ *
42
+ * SH acts as both template tag and options setter: `SH.timeout = 5000; SH`cmd``
43
+ *
44
+ * @param {TemplateStringsArray} pieces - String literals from template.
45
+ * @param {...unknown[]} args - Values to interpolate.
46
+ * @returns {SHDispatch} Command dispatcher.
47
+ * @throws {Error} If pieces contain undefined.
48
+ * @example
49
+ * const cmd = SH`echo ${'Hello'}`;
50
+ * await cmd.run(); // Executes: echo Hello
51
+ *
52
+ * // Array interpolation is raw and joins with spaces
53
+ * SH`ls ${['-la', '/']}`.run(); // Executes: ls -la /
54
+ *
55
+ * // Quote untrusted values explicitly
56
+ * SH`printf '%s\n' ${bashEscape('semi; colon')}`.run();
8
57
  */
9
- export type Shell = Function;
58
+ export const SH: any;
10
59
  /**
11
- * A template-tag that returns an SHDispatch.
60
+ * Changes the current working directory.
61
+ *
62
+ * @param {string} dir - Path to new directory.
63
+ * @example
64
+ * cd('/tmp');
12
65
  */
13
- export type SHTag = (pieces: TemplateStringsArray, ...args: unknown[]) => SHDispatch;
66
+ export function cd(dir: string): void;
14
67
  /**
15
- * A template-tag that returns an SHDispatch.
16
- * @typedef {(pieces: TemplateStringsArray, ...args: unknown[]) => SHDispatch} SHTag
17
- */
68
+ * Sleeps for a specified duration.
69
+ *
70
+ * @param {string|number} duration - Duration as '5s', '100ms', or ms number.
71
+ * @returns {Promise<void>}
72
+ * @example
73
+ * await sleep('2s');
74
+ */
75
+ export function sleep(duration: string | number): Promise<void>;
18
76
  /**
19
- * SH template tag
20
- *
21
- * Interpolation rules:
22
- * - Arrays: each element is String(x).trim(), with newlines/carriage returns/tabs escaped; if an element contains shell metacharacters or spaces, it is wrapped in single-quotes and internal single-quotes are escaped as '\''.
23
- * - Non-array values: currently coerced with String(value) and inserted as-is (NOT shell-escaped). Be careful when interpolating untrusted input.
24
- *
25
- * @type {Shell & SHTag & defaultOptions}
26
- * Returns an SHDispatch that can be configured via .options() and executed with .run() / .runSync().
27
- * @returns {SHDispatch}
28
- */
29
- export const SH: Shell & SHTag & import("./SHDispatch.js").SHOptions;
77
+ * Retries an async function up to N times with optional delays.
78
+ *
79
+ * Delay can be fixed ('1s'), generator-like (expBackoff()), or none.
80
+ *
81
+ * @param {number} count - Positive integer number of attempts.
82
+ * @param {string|number|ExpBackoffGenerator|Function} delayOrCallback - Delay, delay generator, or callback if no separate callback is supplied.
83
+ * @param {Function} [callback] - Callback to retry when a delay is supplied.
84
+ * @returns {Promise<any>} Successful result.
85
+ * @throws {Error} If arguments are invalid, or the last callback error if all attempts fail.
86
+ * @example
87
+ * await retry(3, '1s', () => SH`curl http://unreliable`.run());
88
+ * await retry(3, expBackoff(), () => flakyOp());
89
+ */
90
+ export function retry(count: number, delayOrCallback: string | number | ExpBackoffGenerator | Function, callback?: Function): Promise<any>;
30
91
  /**
31
- * Change working directory
32
- * @param {string} dir
33
- */
34
- export function cd(dir: string): void;
92
+ * Reads entire stdin as UTF-8 string. Resolves to empty string if TTY (no pipe).
93
+ *
94
+ * @returns {Promise<string>} Stdin content, or an empty string if TTY.
95
+ * @example
96
+ * const input = await readIn(); // Use in piped scripts
97
+ */
98
+ export function readIn(): Promise<string>;
35
99
  /**
36
- * This function pauses or "sleeps" code execution for a specified duration.
37
- * @param {string|number} duration - The duration to pause execution for, e.g., '100ms' or '3s'.
38
- *
39
- * @example
40
- *
41
- * await sleep('5s');
42
- */
43
- export function sleep(duration: string | number): Promise<any>;
44
- /**
45
- * Retries a given asynchronous function a specified number of times with optional delays between attempts.
46
- *
47
- * @param {number} count - The number of retry attempts.
48
- * @param {string|number|expBackoff|Function} a - Either a delay duration as a string, a delay generator object, or the callback function.
49
- * @param {Function} [b] - The callback function to retry, required if `a` is not a function.
50
- * @returns {Promise<*>} - The result of the callback function if it succeeds within the retry attempts.
51
- * @throws {Error} - The last error encountered if all retry attempts fail.
52
- *
53
- * @example
54
- * // Retry a command 3 times
55
- * const p = await retry(3, () => SH`curl -s https://flipwrsi`);
56
- *
57
- * // Retry a command 3 times with an interval of 1 second between each try
58
- * const p = await retry(3, '1s', () => SH`curl -s https://flipwrsi`);
59
- *
60
- * // Retry a command 3 times with irregular intervals using exponential backoff
61
- * const p = await retry(3, expBackoff(), () => SH`curl -s https://flipwrsi`);
62
- */
63
- export function retry(count: number, a: string | number | typeof expBackoff | Function, b?: Function): Promise<any>;
64
- /**
65
- * This function reads the standard input (stdin) from the current process.
66
- * @returns {Promise<string>}
67
- * @example
68
- * const content = await readIn();
69
- */
70
- /**
71
- * Read entire stdin as UTF-8. If stdin is a TTY, resolves to an empty string.
72
- * @returns {Promise<string|undefined>}
73
- */
74
- export function readIn(): Promise<string | undefined>;
75
- /**
76
- * Get user input from the command line (stdin)
77
- * void when input has been aborted
78
- * @param {string} prompt - prompt or question
79
- * @returns {{input: Promise<string|void>, abort: function(): void}}
80
- * @example
81
- * const user = userIn('Question: ');
82
- * const content = await user.input
83
- * // user.abort()
84
- */
85
- export function userIn(prompt: string): {
86
- input: Promise<string | void>;
87
- abort: () => void;
88
- };
100
+ * Prompts user for input on stdin with custom prompt.
101
+ *
102
+ * Supports aborting input collection.
103
+ *
104
+ * @param {string} prompt - Prompt text to display.
105
+ * @returns {AbortableInput} Object with input Promise and abort function.
106
+ * @example
107
+ * const {input, abort} = userIn('Enter name: ');
108
+ * const name = await input;
109
+ * // abort(); // Cancel anytime
110
+ */
111
+ export function userIn(prompt: string): AbortableInput;
112
+ /**
113
+ * Executes a callback in a new async context (fresh callstack).
114
+ *
115
+ * Useful for parallel operations without nesting.
116
+ *
117
+ * @param {() => Promise<any>} callback - Async function to execute.
118
+ * @returns {Promise<any>} Result of callback.
119
+ * @example
120
+ * const results = await within(async () => {
121
+ * return Promise.all([SH`sleep 1; echo 1`.run(), sleep(2)]);
122
+ * });
123
+ */
124
+ export function within(callback: () => Promise<any>): Promise<any>;
89
125
  /**
90
- * Create a async/sync context in new execution callstack
91
- * @param {function} callback - async/sync function
92
- * @example
93
- * const p = within(async () => {
94
- * const res = await Promise.all([
95
- * SH`sleep 1; echo 1`.run(),
96
- * SH`sleep 2; echo 2`.run(),
97
- * sleep(2),
98
- * SH`sleep 3; echo 3`.run()
99
- * ]);
100
- * return 'res';
101
- * });
102
- */
103
- export function within(callback: Function): Promise<any>;
104
- /**
105
- * Generates an exponential backoff time with a random jitter.
126
+ * Generator for exponential backoff delays with jitter.
106
127
  *
107
128
  * @generator
108
- * @param {string} [max='60s'] - The maximum backoff time in a human-readable format (e.g., '60s' for 60 seconds).
109
- * @param {string} [rand='100ms'] - The maximum random jitter time in a human-readable format (e.g., '100ms' for 100 milliseconds).
110
- * @yields {number} The backoff time in milliseconds.
129
+ * @param {string} [max='60s'] - Max backoff duration.
130
+ * @param {string} [rand='100ms'] - Max jitter.
131
+ * @yields {number} Next backoff ms.
132
+ * @example
133
+ * const backoff = expBackoff();
134
+ * await sleep(backoff.next().value);
111
135
  */
112
136
  export function expBackoff(max?: string, rand?: string): Generator<number, void, unknown>;
113
137
  /**
114
- * Parses command-line arguments into an object.
115
- *
116
- * The function recognizes arguments that start with two dashes (`--`) or one dash (`-`) as keys,
117
- * and the subsequent value (if not another key) as the corresponding value.
118
- * If a key does not have a value, it defaults to `true`.
119
- * All unrecognized arguments are collected in an array under the `_` property.
120
- *
121
- * @param {string[]} [args] - An array of command-line arguments (process.argv.slice(2)).
122
- * @returns {ArgsObject} An object where:
123
- * - If args is not passed, process.argv.slice(2) will be the default
124
- * - Each key corresponds to an argument that starts with `--` or `-`,
125
- * - The value is either the next argument or `true` if no value is provided,
126
- * - The `_` property contains an array of unbound arguments.
127
- */
128
- /**
129
- * Parse command-line args into an object.
130
- *
131
- * Supported:
132
- * - --key value, -k value (no grouped short flags)
133
- * - Bare values collected under `_.`
134
- * - Duplicate keys throw an error; keys without a following value become true.
135
- *
136
- * Not supported:
137
- * - --key=value syntax
138
- * - Grouped short flags like -abc
139
- *
140
- * @param {string[]} [args]
138
+ * Parses CLI arguments into an object.
139
+ *
140
+ * Supports --key value, -k value (no shorts grouped).
141
+ * Bares go to _[]. Duplicates error. No = syntax.
142
+ * Negative number tokens such as -1, -0.5, and -1e3 are parsed as values or
143
+ * positionals, not options.
144
+ *
145
+ * Defaults to process.argv.slice(2).
146
+ *
147
+ * @param {string[]} [args=process.argv.slice(2)] - Args array.
141
148
  * @returns {ArgsObject}
149
+ * @throws {Error} On invalid/dupe args.
150
+ * @example
151
+ * parseArgs(['--port', '8080', 'file.txt']); // { port: '8080', _: ['file.txt'] }
152
+ * parseArgs(['--n', '-1']); // { n: '-1', _: [] }
142
153
  */
143
154
  export function parseArgs(args?: string[]): ArgsObject;
144
155
  /**
145
- * @typedef {Object.<string, string>} ArgsObject
146
- * @property {string} [key: string] - Any string key maps to a string value
147
- * @property {string[]} _ - Array of strings, unnamed parameters
148
- * @description Parsed parameters result.
149
- */
150
- /**
151
- * @typedef {Function} RejectCallback
152
- * @param {Error} error - The error object passed to the callback.
153
- */
154
- /**
155
- * @typedef {Function} ResolveCallback
156
- * @param {any} [param] - Optional callback any value
157
- */
158
- /**
159
- * Creates a new SHDispatch object that represents a command to be executed.
160
- *
161
- * @typedef {Function} Shell
162
- * @property {function(Array, ...*): ProcessPromise} execute - The function to execute the command.
163
- *
164
- * @param {Array} pieces - An array of string literals from a template literal.
165
- * @param {...*} args - The values to be interpolated into the string literals.
166
- * @returns {SHDispatch} Trigger for the command.
167
- * @throws {Error} Throws an error if any of the string literals in `pieces` is undefined.
168
- *
169
- * @example
170
- * const command = await SH`echo 'Hello, world!'`.run();
171
- */
172
- /**
173
- * Determine a javascript type
174
- *
175
- * @param {any} fn - Any let type
176
- * @returns {string} The "real" object / typeof name
177
- */
156
+ * Parsed command-line arguments.
157
+ *
158
+ * Named options map to their string value, or `true` when no value is supplied.
159
+ * Bare positional arguments are collected in `_`.
160
+ *
161
+ * @typedef {{_: string[]} & Object.<string, string|true|string[]>} ArgsObject
162
+ */
163
+ /**
164
+ * @typedef {Function} RejectCallback
165
+ * @param {Error} error - The error object passed to the callback.
166
+ */
167
+ /**
168
+ * @typedef {Function} ResolveCallback
169
+ * @param {any} [param] - Optional callback any value
170
+ */
171
+ /**
172
+ * @typedef {import('./SHDispatch.js').SHOptions} SHOptions
173
+ */
174
+ /**
175
+ * @typedef {Object} AbortableInput
176
+ * @property {Promise<string|void>} input - Promise that resolves to user input or void if aborted.
177
+ * @property {() => void} abort - Function to abort input collection.
178
+ */
179
+ /**
180
+ * Generator-like object that yields retry delay durations.
181
+ *
182
+ * @typedef {Iterator<number|string>} ExpBackoffGenerator
183
+ */
184
+ /**
185
+ * Utility to determine the JavaScript type of a value.
186
+ *
187
+ * @param {any} fn - Any value to inspect.
188
+ * @returns {string} The "real" object type name (e.g., 'Array', 'Promise') or primitive typeof.
189
+ * @example
190
+ * jsType([]); // 'Array'
191
+ * jsType(Promise.resolve()); // 'Promise'
192
+ */
178
193
  export function jsType(fn: any): string;
179
194
  /**
180
- * 'Code Safe' has own prop
181
- *
182
- * @param {any} o - object to examine
183
- * @param {string} p - property to look for
184
- * @returns {boolean}
185
- */
195
+ * Checks if an object has a specific own property (code-safe).
196
+ *
197
+ * @param {any} o - Object to examine.
198
+ * @param {string} p - Property name to check.
199
+ * @returns {boolean} True if the object has the own property.
200
+ */
186
201
  export function hasProp(o: any, p: string): boolean;
187
202
  import Test from './Test.js';
188
203
  import assert from 'node:assert';
189
204
  import AsyncTracker from './AsyncTracker.js';
190
205
  /**
191
- * bash escape a string suitable as an argument on the commandline
192
- * for javascript code
193
- * @param {string} x
194
- * @returns {string}
195
- */
196
- export function bashEscape(x: string): string;
197
- import SHDispatch from './SHDispatch.js';
206
+ * Quotes a value as one POSIX shell argument.
207
+ *
208
+ * The `SH` template tag interpolates values as raw shell source by default. Use
209
+ * this helper when a JavaScript value must be passed as data instead of shell
210
+ * syntax. The returned string is single-quoted and preserves the exact string
211
+ * value, including leading/trailing whitespace, empty strings, quotes,
212
+ * semicolons, glob characters, tabs, and newlines.
213
+ *
214
+ * @param {unknown} x - Value to quote as a single shell argument.
215
+ * @returns {string} POSIX-shell-quoted argument string.
216
+ * @example
217
+ * await SH`printf '%s\n' ${bashEscape(userInput)}`.run();
218
+ */
219
+ export function bashEscape(x: unknown): string;
198
220
  export { Test, assert, AsyncTracker };
@@ -1,113 +1,128 @@
1
1
  export default SHDispatch;
2
2
  export type SpawnSyncResponse = {
3
3
  /**
4
- * - Exit code of the child process (null if terminated by signal).
4
+ * - Exit code (null if signal).
5
5
  */
6
6
  status: number | null;
7
7
  /**
8
- * - Name of the terminating signal, if any.
8
+ * - Terminating signal.
9
9
  */
10
10
  signal: string | null;
11
11
  /**
12
- * - [stdin, stdout, stderr] per Node's SpawnSyncReturns.
12
+ * - [stdin, stdout, stderr].
13
13
  */
14
14
  output: (string | Buffer | null)[];
15
15
  /**
16
- * - PID of the spawned process.
16
+ * - Process ID.
17
17
  */
18
18
  pid: number;
19
19
  /**
20
- * - Stdout collected (type depends on encoding option).
20
+ * - Captured stdout.
21
21
  */
22
22
  stdout: string | Buffer | null;
23
23
  /**
24
- * - Stderr collected (type depends on encoding option).
24
+ * - Captured stderr.
25
25
  */
26
26
  stderr: string | Buffer | null;
27
27
  };
28
+ export type StdioOption = ("pipe" | "ignore" | "inherit" | number);
29
+ export type StdioOptions = Array<StdioOption> | StdioOption;
30
+ /**
31
+ * Core options for SH/SHDispatch.
32
+ *
33
+ * Defaults (merged from global SH):
34
+ * - `cwd`: `process.cwd()`
35
+ * - `env`: `process.env`
36
+ * - `shell`: `'bash'` (string/true → shell; false → no-shell `/usr/bin/env -S`)
37
+ * - `stdio`: `['inherit', 'pipe', 'pipe']`
38
+ * - `timeout`: `0` (no timeout; rolling on data)
39
+ * - `maxBuffer`: `512000` (500 kb per stream in SHExecute)
40
+ *
41
+ * Prefix (`.options(undefined, prefix)`) only for shell mode.
42
+ */
28
43
  export type SHOptions = {
29
44
  /**
30
- * - Current working directory of the child process.
45
+ * - Working directory for spawned commands.
31
46
  */
32
- cwd?: string | undefined;
33
- /**
34
- * - Environment key-value pairs.
35
- */
36
- env?: Object | undefined;
37
- /**
38
- * - Explicitly set the value of `argv[0]` sent to the child process.
39
- */
40
- argv0?: string | undefined;
41
- /**
42
- * - If true, the child will be a process group leader.
43
- */
44
- detached?: boolean | undefined;
47
+ cwd: string;
45
48
  /**
46
- * - Sets the user identity of the process.
49
+ * - Environment for spawned commands.
47
50
  */
48
- uid?: number | undefined;
51
+ env: NodeJS.ProcessEnv;
49
52
  /**
50
- * - Sets the group identity of the process.
53
+ * - Shell executable, true for bash, or false for no-shell mode.
51
54
  */
52
- gid?: number | undefined;
55
+ shell: string | boolean;
53
56
  /**
54
- * - Child's stdio configuration.
57
+ * - Stdio config passed to child_process.
55
58
  */
56
- stdio?: number | "pipe" | "ignore" | "inherit" | StdioOption[] | undefined;
59
+ stdio: StdioOptions;
57
60
  /**
58
- * - If string or true, runs the command via that shell ('bash' if true).
61
+ * - Rolling timeout in ms or duration string; 0 disables timeout.
59
62
  */
60
- shell?: string | boolean | undefined;
63
+ timeout: number | string;
61
64
  /**
62
- * - Milliseconds before sending SIGTERM (0 = no timeout).
65
+ * - Maximum buffered bytes per stdout/stderr stream.
63
66
  */
64
- timeout?: number | undefined;
67
+ maxBuffer?: number | undefined;
65
68
  /**
66
- * - Optional stdin payload for spawnSync. Use .run(payload) for async.
69
+ * - Run process detached and resolve early.
67
70
  */
68
- input?: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike> | undefined;
71
+ detached?: boolean | undefined;
69
72
  };
70
- export type StdioOption = ("pipe" | "ignore" | "inherit" | number);
71
- export type StdioOptions = Array<StdioOption> | StdioOption;
72
73
  /**
73
- * SHOptions — effective defaults and semantics used by SHDispatch/SHExecute
74
+ * High-level command dispatcher.
74
75
  *
75
- * Defaults:
76
- * - cwd: process.cwd()
77
- * - env: process.env
78
- * - shell: 'bash' (string). If a string, that shell is used. If true, 'bash' is used. If false/undefined, no shell is used.
79
- * - stdio: ['inherit', 'pipe', 'pipe'] — inherit stdin, capture stdout/stderr
80
- * - timeout: 0 — no timeout
81
- * - maxBuffer?: number — optional (bytes per stream). Passed through to SHExecute.
76
+ * Created by {@link SH`cmd`}; chain `.options()` then `.run()`.
82
77
  *
83
- * Notes:
84
- * - The prefix (see options(prefix)) is only applied when a shell is used; it is ignored in no-shell mode.
85
- * - Each call to options() resets to the defaults and merges the provided options; it does not accumulate from prior calls.
78
+ * Delegates to {@link SHExecute} for exec/timeout/buffer/kill.
79
+ *
80
+ * @example
81
+ * const dispatch = SH`ls -la`.options({ timeout: '2s' });
82
+ * const out = await dispatch.run();
86
83
  */
87
84
  declare class SHDispatch {
88
85
  /**
89
- * @param {string} cmd - cmd to execute
90
- * @param {SHOptions} options
91
- * @param {string} [prefix] - command prefix e.g (default) '/usr/bin/env'
92
- */
93
- constructor(cmd: string, options: SHOptions, prefix?: string);
94
- /**
95
- * @param {SHOptions} [options]
96
- * @param {string} [prefix] - command prefix e.g (default) '/usr/bin/env'
97
- * @returns {SHDispatch}
98
- */
99
- options(options?: SHOptions, prefix?: string): SHDispatch;
100
- /**
101
- * @param {string} [payload]
102
- * @returns {Promise<string>}
103
- */
86
+ * @param {string} cmd - Command string.
87
+ * @param {Partial<SHOptions>} [options] - Initial options.
88
+ * @param {string} [prefix] - Shell prefix (e.g., 'set -euo pipefail').
89
+ * @throws {Error} Invalid/empty cmd.
90
+ */
91
+ constructor(cmd: string, options?: Partial<SHOptions>, prefix?: string);
92
+ /**
93
+ * Updates options/prefix by merging into the dispatch instance's current options.
94
+ *
95
+ * This preserves global `SH.*` defaults captured when the command was created
96
+ * and only overrides options explicitly supplied for this command. Strings for
97
+ * `stdio` are expanded to `[value, value, value]`.
98
+ *
99
+ * @param {Partial<SHOptions>} [options] - New options.
100
+ * @param {string} [prefix] - New prefix.
101
+ * @returns {SHDispatch} Self for chaining.
102
+ */
103
+ options(options?: Partial<SHOptions>, prefix?: string): SHDispatch;
104
+ /**
105
+ * Async run: Captures stdout; rejects on error/timeout.
106
+ *
107
+ * @param {string} [payload] - Stdin payload.
108
+ * @returns {Promise<string>} Stdout.
109
+ */
104
110
  run(payload?: string): Promise<string>;
105
111
  /**
106
- * Works for terminal screen takeovers like editors
107
- * @param {string} [payload]
108
- * @returns {import('child_process').SpawnSyncReturns}
109
- */
110
- runSync(payload?: string): import("child_process").SpawnSyncReturns<any>;
111
- kill(signal?: string): Promise<number[]>;
112
+ * Sync run: Full Node SpawnSyncReturns.
113
+ *
114
+ * Good for TTY takeovers (e.g., vim).
115
+ *
116
+ * @param {string} [payload] - Stdin payload.
117
+ * @returns {import('child_process').SpawnSyncReturns<Buffer>}
118
+ */
119
+ runSync(payload?: string): import("child_process").SpawnSyncReturns<Buffer>;
120
+ /**
121
+ * Kills running process + children.
122
+ *
123
+ * @param {number | string} [signal='SIGTERM'] - Signal.
124
+ * @returns {Promise<number[]>} Killed PIDs.
125
+ */
126
+ kill(signal?: number | string): Promise<number[]>;
112
127
  #private;
113
128
  }