teen_process 2.0.3 → 2.0.5

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.
@@ -0,0 +1,108 @@
1
+ export default exec;
2
+ /**
3
+ * Options on top of `SpawnOptions`, unique to `teen_process.`
4
+ */
5
+ export type TeenProcessProps = {
6
+ /**
7
+ * - Ignore & discard all output
8
+ */
9
+ ignoreOutput?: boolean | undefined;
10
+ /**
11
+ * - Return output as a Buffer
12
+ */
13
+ isBuffer?: boolean | undefined;
14
+ /**
15
+ * - Logger to use for debugging
16
+ */
17
+ logger?: TeenProcessLogger | undefined;
18
+ /**
19
+ * - Maximum size of `stdout` buffer
20
+ */
21
+ maxStdoutBufferSize?: number | undefined;
22
+ /**
23
+ * - Maximum size of `stderr` buffer
24
+ */
25
+ maxStderrBufferSize?: number | undefined;
26
+ /**
27
+ * - Encoding to use for output
28
+ */
29
+ encoding?: BufferEncoding | undefined;
30
+ };
31
+ /**
32
+ * A logger object understood by {@link exec teen_process.exec}.
33
+ */
34
+ export type TeenProcessLogger = {
35
+ debug: (...args: any[]) => void;
36
+ };
37
+ /**
38
+ * Options for {@link exec teen_process.exec}.
39
+ */
40
+ export type TeenProcessExecOptions = import('child_process').SpawnOptions & TeenProcessProps;
41
+ /**
42
+ * The value {@link exec teen_process.exec} resolves to when `isBuffer` is `false`
43
+ */
44
+ export type TeenProcessExecStringResult = {
45
+ /**
46
+ * - Stdout
47
+ */
48
+ stdout: string;
49
+ /**
50
+ * - Stderr
51
+ */
52
+ stderr: string;
53
+ /**
54
+ * - Exit code
55
+ */
56
+ code: number | null;
57
+ };
58
+ /**
59
+ * The value {@link exec teen_process.exec} resolves to when `isBuffer` is `true`
60
+ */
61
+ export type TeenProcessExecBufferResult = {
62
+ /**
63
+ * - Stdout
64
+ */
65
+ stdout: Buffer;
66
+ /**
67
+ * - Stderr
68
+ */
69
+ stderr: Buffer;
70
+ /**
71
+ * - Exit code
72
+ */
73
+ code: number | null;
74
+ };
75
+ /**
76
+ * Extra props {@link exec teen_process.exec} adds to its error objects
77
+ */
78
+ export type TeenProcessExecErrorProps = {
79
+ /**
80
+ * - STDOUT
81
+ */
82
+ stdout: string;
83
+ /**
84
+ * - STDERR
85
+ */
86
+ stderr: string;
87
+ /**
88
+ * - Exit code
89
+ */
90
+ code: number | null;
91
+ };
92
+ /**
93
+ * Error thrown by {@link exec teen_process.exec}
94
+ */
95
+ export type TeenProcessExecError = Error & TeenProcessExecErrorProps;
96
+ export type BufferProp<MaybeBuffer extends {
97
+ isBuffer?: boolean | undefined;
98
+ }> = MaybeBuffer['isBuffer'];
99
+ /**
100
+ * Spawns a process
101
+ * @template {TeenProcessExecOptions} T
102
+ * @param {string} cmd - Program to execute
103
+ * @param {string[]} [args] - Arguments to pass to the program
104
+ * @param {T} [opts] - Options
105
+ * @returns {Promise<BufferProp<T> extends true ? TeenProcessExecBufferResult : TeenProcessExecStringResult>}
106
+ */
107
+ export function exec<T extends TeenProcessExecOptions>(cmd: string, args?: string[] | undefined, opts?: T | undefined): Promise<BufferProp<T> extends true ? TeenProcessExecBufferResult : TeenProcessExecStringResult>;
108
+ //# sourceMappingURL=exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../lib/exec.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuKwB,GAAG,EAAE,KAAK,IAAI;;;;;qCAKzB,OAAO,eAAe,EAAE,YAAY,GAAG,gBAAgB;;;;;;;;YAMtD,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;;;;;;YAMN,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;;;;;;YAMN,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;;mCAKP,KAAK,GAAG,yBAAyB;;;KAKjC,WAAW,CAAC,UAAU,CAAC;AApMpC;;;;;;;GAOG;AACH,4DALW,MAAM,sJAuIhB"}
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ /* eslint-disable promise/prefer-await-to-callbacks */
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.exec = void 0;
8
+ const child_process_1 = require("child_process");
9
+ const shell_quote_1 = require("shell-quote");
10
+ const bluebird_1 = __importDefault(require("bluebird"));
11
+ const lodash_1 = __importDefault(require("lodash"));
12
+ const helpers_1 = require("./helpers");
13
+ const MAX_BUFFER_SIZE = 100 * 1024 * 1024;
14
+ /**
15
+ * Spawns a process
16
+ * @template {TeenProcessExecOptions} T
17
+ * @param {string} cmd - Program to execute
18
+ * @param {string[]} [args] - Arguments to pass to the program
19
+ * @param {T} [opts] - Options
20
+ * @returns {Promise<BufferProp<T> extends true ? TeenProcessExecBufferResult : TeenProcessExecStringResult>}
21
+ */
22
+ async function exec(cmd, args = [], opts = /** @type {T} */ ({})) {
23
+ // get a quoted representation of the command for error strings
24
+ const rep = (0, shell_quote_1.quote)([cmd, ...args]);
25
+ // extend default options; we're basically re-implementing exec's options
26
+ // for use here with spawn under the hood
27
+ opts = /** @type {T} */ (lodash_1.default.defaults(opts, {
28
+ timeout: null,
29
+ encoding: 'utf8',
30
+ killSignal: 'SIGTERM',
31
+ cwd: undefined,
32
+ env: process.env,
33
+ ignoreOutput: false,
34
+ stdio: 'inherit',
35
+ isBuffer: false,
36
+ shell: undefined,
37
+ logger: undefined,
38
+ maxStdoutBufferSize: MAX_BUFFER_SIZE,
39
+ maxStderrBufferSize: MAX_BUFFER_SIZE,
40
+ }));
41
+ const isBuffer = Boolean(opts.isBuffer);
42
+ // this is an async function, so return a promise
43
+ return await new bluebird_1.default((resolve, reject) => {
44
+ // spawn the child process with options; we don't currently expose any of
45
+ // the other 'spawn' options through the API
46
+ let proc = (0, child_process_1.spawn)(cmd, args, { cwd: opts.cwd, env: opts.env, shell: opts.shell });
47
+ let stdoutArr = [], stderrArr = [], timer = null;
48
+ // if the process errors out, reject the promise
49
+ proc.on('error', /** @param {NodeJS.ErrnoException} err */ async (err) => {
50
+ if (err.code === 'ENOENT') {
51
+ err = await (0, helpers_1.formatEnoent)(err, cmd, opts.cwd?.toString());
52
+ }
53
+ reject(err);
54
+ });
55
+ if (proc.stdin) {
56
+ proc.stdin.on('error', /** @param {NodeJS.ErrnoException} err */ (err) => {
57
+ reject(new Error(`Standard input '${err.syscall}' error: ${err.stack}`));
58
+ });
59
+ }
60
+ const handleStream = (streamType, streamProps) => {
61
+ if (!proc[streamType]) {
62
+ return;
63
+ }
64
+ proc[streamType].on('error', (err) => {
65
+ reject(new Error(`${lodash_1.default.capitalize(streamType)} '${err.syscall}' error: ${err.stack}`));
66
+ });
67
+ if (opts.ignoreOutput) {
68
+ // https://github.com/nodejs/node/issues/4236
69
+ proc[streamType].on('data', () => { });
70
+ return;
71
+ }
72
+ // keep track of the stream if we don't want to ignore it
73
+ const { chunks, maxSize } = streamProps;
74
+ let size = 0;
75
+ proc[streamType].on('data', (chunk) => {
76
+ chunks.push(chunk);
77
+ size += chunk.length;
78
+ while (chunks.length > 1 && size >= maxSize) {
79
+ size -= chunks[0].length;
80
+ chunks.shift();
81
+ }
82
+ if (opts.logger && lodash_1.default.isFunction(opts.logger.debug)) {
83
+ opts.logger.debug(chunk.toString());
84
+ }
85
+ });
86
+ };
87
+ handleStream('stdout', {
88
+ maxSize: opts.maxStdoutBufferSize,
89
+ chunks: stdoutArr,
90
+ });
91
+ handleStream('stderr', {
92
+ maxSize: opts.maxStderrBufferSize,
93
+ chunks: stderrArr,
94
+ });
95
+ /**
96
+ * @template {boolean} U
97
+ * @param {U} isBuffer
98
+ * @returns {U extends true ? {stdout: Buffer, stderr: Buffer} : {stdout: string, stderr: string}}
99
+ */
100
+ function getStdio(isBuffer) {
101
+ let stdout, stderr;
102
+ if (isBuffer) {
103
+ stdout = Buffer.concat(stdoutArr);
104
+ stderr = Buffer.concat(stderrArr);
105
+ }
106
+ else {
107
+ stdout = Buffer.concat(stdoutArr).toString(opts.encoding);
108
+ stderr = Buffer.concat(stderrArr).toString(opts.encoding);
109
+ }
110
+ return /** @type {U extends true ? {stdout: Buffer, stderr: Buffer} : {stdout: string, stderr: string}} */ ({ stdout, stderr });
111
+ }
112
+ // if the process ends, either resolve or reject the promise based on the
113
+ // exit code of the process. either way, attach stdout, stderr, and code.
114
+ // Also clean up the timer if it exists
115
+ proc.on('close', (code) => {
116
+ if (timer) {
117
+ clearTimeout(timer);
118
+ }
119
+ let { stdout, stderr } = getStdio(isBuffer);
120
+ if (code === 0) {
121
+ resolve(/** @type {BufferProp<T> extends true ? TeenProcessExecBufferResult : TeenProcessExecStringResult} */ ({ stdout, stderr, code }));
122
+ }
123
+ else {
124
+ let err = new Error(`Command '${rep}' exited with code ${code}`);
125
+ err = Object.assign(err, { stdout, stderr, code });
126
+ reject(err);
127
+ }
128
+ });
129
+ // if we set a timeout on the child process, cut into the execution and
130
+ // reject if the timeout is reached. Attach the stdout/stderr we currently
131
+ // have in case it's helpful in debugging
132
+ if (opts.timeout) {
133
+ timer = setTimeout(() => {
134
+ let { stdout, stderr } = getStdio(isBuffer);
135
+ let err = new Error(`Command '${rep}' timed out after ${opts.timeout}ms`);
136
+ err = Object.assign(err, { stdout, stderr, code: null });
137
+ reject(err);
138
+ // reject and THEN kill to avoid race conditions with the handlers
139
+ // above
140
+ proc.kill(opts.killSignal);
141
+ }, opts.timeout);
142
+ }
143
+ });
144
+ }
145
+ exports.exec = exec;
146
+ exports.default = exec;
147
+ /**
148
+ * Options on top of `SpawnOptions`, unique to `teen_process.`
149
+ * @typedef {Object} TeenProcessProps
150
+ * @property {boolean} [ignoreOutput] - Ignore & discard all output
151
+ * @property {boolean} [isBuffer] - Return output as a Buffer
152
+ * @property {TeenProcessLogger} [logger] - Logger to use for debugging
153
+ * @property {number} [maxStdoutBufferSize] - Maximum size of `stdout` buffer
154
+ * @property {number} [maxStderrBufferSize] - Maximum size of `stderr` buffer
155
+ * @property {BufferEncoding} [encoding='utf8'] - Encoding to use for output
156
+ */
157
+ /**
158
+ * A logger object understood by {@link exec teen_process.exec}.
159
+ * @typedef {Object} TeenProcessLogger
160
+ * @property {(...args: any[]) => void} debug
161
+ */
162
+ /**
163
+ * Options for {@link exec teen_process.exec}.
164
+ * @typedef {import('child_process').SpawnOptions & TeenProcessProps} TeenProcessExecOptions
165
+ */
166
+ /**
167
+ * The value {@link exec teen_process.exec} resolves to when `isBuffer` is `false`
168
+ * @typedef {Object} TeenProcessExecStringResult
169
+ * @property {string} stdout - Stdout
170
+ * @property {string} stderr - Stderr
171
+ * @property {number?} code - Exit code
172
+ */
173
+ /**
174
+ * The value {@link exec teen_process.exec} resolves to when `isBuffer` is `true`
175
+ * @typedef {Object} TeenProcessExecBufferResult
176
+ * @property {Buffer} stdout - Stdout
177
+ * @property {Buffer} stderr - Stderr
178
+ * @property {number?} code - Exit code
179
+ */
180
+ /**
181
+ * Extra props {@link exec teen_process.exec} adds to its error objects
182
+ * @typedef {Object} TeenProcessExecErrorProps
183
+ * @property {string} stdout - STDOUT
184
+ * @property {string} stderr - STDERR
185
+ * @property {number?} code - Exit code
186
+ */
187
+ /**
188
+ * Error thrown by {@link exec teen_process.exec}
189
+ * @typedef {Error & TeenProcessExecErrorProps} TeenProcessExecError
190
+ */
191
+ /**
192
+ * @template {{isBuffer?: boolean}} MaybeBuffer
193
+ * @typedef {MaybeBuffer['isBuffer']} BufferProp
194
+ * @private
195
+ */
196
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../lib/exec.js"],"names":[],"mappings":";AAAA,sDAAsD;;;;;;AAEtD,iDAAsC;AACtC,6CAAoC;AACpC,wDAAyB;AACzB,oDAAuB;AACvB,uCAAyC;AAEzC,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,KAAK,UAAU,IAAI,CAAE,GA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CAAC;YAC7B,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAEQ,oBAAI;AACb,kBAAe,IAAI,CAAC;AAEpB;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AAEH;;;;GAIG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Decorates ENOENT error received from a spawn system call
3
+ * with a more descriptive message, so it could be properly handled by a user.
4
+ *
5
+ * @param {NodeJS.ErrnoException} error Original error instance. !!! The instance is mutated after
6
+ * this helper function invocation
7
+ * @param {string} cmd Original command to execute
8
+ * @param {string?} [cwd] Optional path to the current working dir
9
+ * @returns {Promise<NodeJS.ErrnoException>} Mutated error instance with an improved description or an
10
+ * unchanged error instance
11
+ */
12
+ export function formatEnoent(error: NodeJS.ErrnoException, cmd: string, cwd?: string | null | undefined): Promise<NodeJS.ErrnoException>;
13
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,oCAPW,OAAO,cAAc,OAErB,MAAM,oCAEJ,QAAQ,OAAO,cAAc,CAAC,CAwB1C"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatEnoent = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const promises_1 = __importDefault(require("fs/promises"));
9
+ /**
10
+ * Decorates ENOENT error received from a spawn system call
11
+ * with a more descriptive message, so it could be properly handled by a user.
12
+ *
13
+ * @param {NodeJS.ErrnoException} error Original error instance. !!! The instance is mutated after
14
+ * this helper function invocation
15
+ * @param {string} cmd Original command to execute
16
+ * @param {string?} [cwd] Optional path to the current working dir
17
+ * @returns {Promise<NodeJS.ErrnoException>} Mutated error instance with an improved description or an
18
+ * unchanged error instance
19
+ */
20
+ async function formatEnoent(error, cmd, cwd = null) {
21
+ if (cwd) {
22
+ try {
23
+ const stat = await promises_1.default.stat(cwd);
24
+ if (!stat.isDirectory()) {
25
+ error.message = `The working directory '${cwd}' of '${cmd}' is not a valid folder path`;
26
+ return error;
27
+ }
28
+ }
29
+ catch (e) {
30
+ if (e.code === 'ENOENT') {
31
+ error.message = `The working directory '${cwd}' of '${cmd}' does not exist`;
32
+ return error;
33
+ }
34
+ }
35
+ }
36
+ const curDir = path_1.default.resolve(cwd ?? process.cwd());
37
+ const pathMsg = process.env.PATH ?? 'which is not defined for the process';
38
+ error.message = `'${cmd}' executable is not found neither in the process working folder (${curDir}) ` +
39
+ `nor in any folders specified in the PATH environment variable (${pathMsg})`;
40
+ return error;
41
+ }
42
+ exports.formatEnoent = formatEnoent;
43
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2DAA6B;AAE7B;;;;;;;;;;GAUG;AACH,KAAK,UAAU,YAAY,CAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI;IACjD,IAAI,GAAG,EAAE;QACP,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;gBACvB,KAAK,CAAC,OAAO,GAAG,0BAA0B,GAAG,SAAS,GAAG,8BAA8B,CAAC;gBACxF,OAAO,KAAK,CAAC;aACd;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACvB,KAAK,CAAC,OAAO,GAAG,0BAA0B,GAAG,SAAS,GAAG,kBAAkB,CAAC;gBAC5E,OAAO,KAAK,CAAC;aACd;SACF;KACF;IAED,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,sCAAsC,CAAC;IAC3E,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,oEAAoE,MAAM,IAAI;QACnG,kEAAkE,OAAO,GAAG,CAAC;IAC/E,OAAO,KAAK,CAAC;AACf,CAAC;AAEQ,oCAAY"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ export const exec: typeof execIndex.exec;
3
+ export const spawn: typeof cp.spawn;
4
+ export const SubProcess: typeof spIndex.SubProcess;
5
+ import * as execIndex from './exec';
6
+ import * as cp from 'child_process';
7
+ import * as spIndex from './subprocess';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;2BAK2B,QAAQ;oBAFf,eAAe;yBACV,cAAc"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SubProcess = exports.spawn = exports.exec = void 0;
27
+ const source_map_support_1 = require("source-map-support");
28
+ (0, source_map_support_1.install)();
29
+ const cp = __importStar(require("child_process"));
30
+ const spIndex = __importStar(require("./subprocess"));
31
+ const execIndex = __importStar(require("./exec"));
32
+ const { spawn } = cp;
33
+ exports.spawn = spawn;
34
+ const { SubProcess } = spIndex;
35
+ exports.SubProcess = SubProcess;
36
+ const { exec } = execIndex;
37
+ exports.exec = exec;
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA2C;AAC3C,IAAA,4BAAO,GAAE,CAAC;AAEV,kDAAoC;AACpC,sDAAwC;AACxC,kDAAoC;AAEpC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAIN,sBAAK;AAHpB,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;AAGT,gCAAU;AAFhC,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;AAElB,oBAAI"}
@@ -0,0 +1,66 @@
1
+ /// <reference types="node" />
2
+ export default SubProcess;
3
+ export type StartDetector = (stdout: string, stderr?: string | undefined) => any;
4
+ export class SubProcess extends events {
5
+ /**
6
+ * @param {string} cmd
7
+ * @param {string[]} [args]
8
+ * @param {any} [opts]
9
+ */
10
+ constructor(cmd: string, args?: string[] | undefined, opts?: any);
11
+ /**
12
+ * @type { {stdout: string, stderr: string} }
13
+ */
14
+ lastLinePortion: {
15
+ stdout: string;
16
+ stderr: string;
17
+ };
18
+ /** @type {import('child_process').ChildProcess?} */
19
+ proc: import('child_process').ChildProcess | null;
20
+ /** @type {string[]} */
21
+ args: string[];
22
+ /**
23
+ * @type {string}
24
+ */
25
+ cmd: string;
26
+ /**
27
+ * @type {any}
28
+ */
29
+ opts: any;
30
+ /**
31
+ * @type {boolean}
32
+ */
33
+ expectingExit: boolean;
34
+ /**
35
+ * @type {string}
36
+ */
37
+ rep: string;
38
+ get isRunning(): boolean;
39
+ /**
40
+ *
41
+ * @param {string} stream
42
+ * @param {Iterable<string>} lines
43
+ */
44
+ emitLines(stream: string, lines: Iterable<string>): void;
45
+ /**
46
+ *
47
+ * @param {StartDetector|number?} startDetector
48
+ * @param {number?} timeoutMs
49
+ * @param {boolean} detach
50
+ * @returns {Promise<void>}
51
+ */
52
+ start(startDetector?: StartDetector | (number | null), timeoutMs?: number | null, detach?: boolean): Promise<void>;
53
+ handleLastLines(): void;
54
+ /**
55
+ *
56
+ * @param {NodeJS.Signals} signal
57
+ * @param {number} timeout
58
+ * @returns {Promise<void>}
59
+ */
60
+ stop(signal?: NodeJS.Signals, timeout?: number): Promise<void>;
61
+ join(allowedExitCodes?: number[]): Promise<any>;
62
+ detachProcess(): void;
63
+ get pid(): number | null | undefined;
64
+ }
65
+ import events from 'events';
66
+ //# sourceMappingURL=subprocess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess.d.ts","sourceRoot":"","sources":["../../lib/subprocess.js"],"names":[],"mappings":";;qCAsVW,MAAM,kCAEJ,GAAG;AAhUhB;IAiCE;;;;OAIG;IACH,iBAJW,MAAM,sCAEN,GAAG,EAkBb;IApDD;;OAEG;IACH,iBAFW;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAE3B;IAEhB,oDAAoD;IACpD,MADW,OAAO,eAAe,EAAE,YAAY,QAC1C;IAEL,uBAAuB;IACvB,MADW,MAAM,EAAE,CACd;IAEL;;OAEG;IACH,KAFU,MAAM,CAEZ;IAEJ;;MAEE;IACF,MAFU,GAAG,CAER;IAEL;;OAEG;IACH,eAFU,OAAO,CAEH;IAEd;;OAEG;IACH,KAFU,MAAM,CAEZ;IAyBJ,yBAGC;IAED;;;;OAIG;IACH,kBAHW,MAAM,SACN,SAAS,MAAM,CAAC,QAM1B;IAID;;;;;;OAMG;IACH,sBALW,aAAa,IAAC,MAAM,QAAC,cACrB,MAAM,kBACN,OAAO,GACL,QAAQ,IAAI,CAAC,CAkKzB;IAED,wBASC;IAED;;;;;OAKG;IACH,cAJW,OAAO,OAAO,YACd,MAAM,GACJ,QAAQ,IAAI,CAAC,CAmBzB;IAED,gDAcC;IAKD,sBAQC;IAED,qCAEC;CACF;mBA5UkB,QAAQ"}
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ /* eslint-disable promise/prefer-await-to-callbacks */
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SubProcess = void 0;
8
+ const child_process_1 = require("child_process");
9
+ const events_1 = __importDefault(require("events"));
10
+ const { EventEmitter } = events_1.default;
11
+ const bluebird_1 = __importDefault(require("bluebird"));
12
+ const shell_quote_1 = require("shell-quote");
13
+ const lodash_1 = __importDefault(require("lodash"));
14
+ const helpers_1 = require("./helpers");
15
+ // This is needed to avoid memory leaks
16
+ // when the process output is too long and contains
17
+ // no line breaks
18
+ const MAX_LINE_PORTION_LENGTH = 0xFFFF;
19
+ function cutSuffix(str, suffixLength) {
20
+ return str.length > suffixLength
21
+ // https://bugs.chromium.org/p/v8/issues/detail?id=2869
22
+ ? ` ${str.substr(str.length - suffixLength)}`.substr(1)
23
+ : str;
24
+ }
25
+ class SubProcess extends EventEmitter {
26
+ /**
27
+ * @param {string} cmd
28
+ * @param {string[]} [args]
29
+ * @param {any} [opts]
30
+ */
31
+ constructor(cmd, args = [], opts = {}) {
32
+ super();
33
+ if (!cmd)
34
+ throw new Error('Command is required'); // eslint-disable-line curly
35
+ if (!lodash_1.default.isString(cmd))
36
+ throw new Error('Command must be a string'); // eslint-disable-line curly
37
+ if (!lodash_1.default.isArray(args))
38
+ throw new Error('Args must be an array'); // eslint-disable-line curly
39
+ this.cmd = cmd;
40
+ this.args = args;
41
+ this.proc = null;
42
+ this.opts = opts;
43
+ this.expectingExit = false;
44
+ // get a quoted representation of the command for error strings
45
+ this.rep = (0, shell_quote_1.quote)([cmd, ...args]);
46
+ this.lastLinePortion = { stdout: '', stderr: '' };
47
+ }
48
+ get isRunning() {
49
+ // presence of `proc` means we have connected and started
50
+ return !!this.proc;
51
+ }
52
+ /**
53
+ *
54
+ * @param {string} stream
55
+ * @param {Iterable<string>} lines
56
+ */
57
+ emitLines(stream, lines) {
58
+ for (let line of lines) {
59
+ this.emit('stream-line', `[${stream.toUpperCase()}] ${line}`);
60
+ }
61
+ }
62
+ // spawn the subprocess and return control whenever we deem that it has fully
63
+ // "started"
64
+ /**
65
+ *
66
+ * @param {StartDetector|number?} startDetector
67
+ * @param {number?} timeoutMs
68
+ * @param {boolean} detach
69
+ * @returns {Promise<void>}
70
+ */
71
+ async start(startDetector = null, timeoutMs = null, detach = false) {
72
+ let startDelay = 10;
73
+ const genericStartDetector = /** @type {StartDetector} */ (function genericStartDetector(stdout, stderr) {
74
+ return stdout || stderr;
75
+ });
76
+ // the default start detector simply returns true when we get any output
77
+ if (startDetector === null) {
78
+ startDetector = genericStartDetector;
79
+ }
80
+ // if the user passes a number, then we simply delay a certain amount of
81
+ // time before returning control, rather than waiting for a condition
82
+ if (lodash_1.default.isNumber(startDetector)) {
83
+ startDelay = startDetector;
84
+ startDetector = null;
85
+ }
86
+ // if the user passes in a boolean as one of the arguments, use it for `detach`
87
+ if (lodash_1.default.isBoolean(startDetector) && startDetector) {
88
+ if (!this.opts.detached) {
89
+ throw new Error(`Unable to detach process that is not started with 'detached' option`);
90
+ }
91
+ detach = true;
92
+ startDetector = genericStartDetector;
93
+ }
94
+ else if (lodash_1.default.isBoolean(timeoutMs) && timeoutMs) {
95
+ if (!this.opts.detached) {
96
+ throw new Error(`Unable to detach process that is not started with 'detached' option`);
97
+ }
98
+ detach = true;
99
+ timeoutMs = null;
100
+ }
101
+ // return a promise so we can wrap the async behavior
102
+ return await new bluebird_1.default((resolve, reject) => {
103
+ // actually spawn the subproc
104
+ this.proc = (0, child_process_1.spawn)(this.cmd, this.args, this.opts);
105
+ if (this.proc.stdout) {
106
+ this.proc.stdout.setEncoding(this.opts.encoding || 'utf8');
107
+ }
108
+ if (this.proc.stderr) {
109
+ this.proc.stderr.setEncoding(this.opts.encoding || 'utf8');
110
+ }
111
+ this.lastLinePortion = { stdout: '', stderr: '' };
112
+ // this function handles output that we collect from the subproc
113
+ /**
114
+ *
115
+ * @param { {stdout: string, stderr: string} } streams
116
+ */
117
+ const handleOutput = (streams) => {
118
+ const { stdout, stderr } = streams;
119
+ // if we have a startDetector, run it on the output so we can resolve/
120
+ // reject and move on from start
121
+ try {
122
+ if (lodash_1.default.isFunction(startDetector) && startDetector(stdout, stderr)) {
123
+ startDetector = null;
124
+ resolve();
125
+ }
126
+ }
127
+ catch (e) {
128
+ reject(e);
129
+ }
130
+ // emit the actual output for whomever's listening
131
+ this.emit('output', stdout, stderr);
132
+ // we also want to emit lines, but it's more complex since output
133
+ // comes in chunks and a line could come in two different chunks, so
134
+ // we have logic to handle that case (using this.lastLinePortion to
135
+ // remember a line that started but did not finish in the last chunk)
136
+ for (const [streamName, streamData] of /** @type {[['stdout', string], ['stderr', string]]} */ (lodash_1.default.toPairs(streams))) {
137
+ if (!streamData)
138
+ continue; // eslint-disable-line curly
139
+ const lines = streamData.split('\n')
140
+ // https://bugs.chromium.org/p/v8/issues/detail?id=2869
141
+ .map((x) => ` ${x}`.substr(1));
142
+ if (lines.length > 1) {
143
+ lines[0] = this.lastLinePortion[streamName] + lines[0];
144
+ this.lastLinePortion[streamName] = cutSuffix(lodash_1.default.last(lines), MAX_LINE_PORTION_LENGTH);
145
+ const resultLines = lines.slice(0, -1);
146
+ this.emit(`lines-${streamName}`, resultLines);
147
+ this.emitLines(streamName, resultLines);
148
+ }
149
+ else {
150
+ const currentPortion = cutSuffix(lines[0], MAX_LINE_PORTION_LENGTH);
151
+ if (this.lastLinePortion[streamName].length + currentPortion.length > MAX_LINE_PORTION_LENGTH) {
152
+ this.lastLinePortion[streamName] = currentPortion;
153
+ }
154
+ else {
155
+ this.lastLinePortion[streamName] += currentPortion;
156
+ }
157
+ }
158
+ }
159
+ };
160
+ // if we get an error spawning the proc, reject and clean up the proc
161
+ this.proc.on('error', /** @param {NodeJS.ErrnoException} err */ async (err) => {
162
+ this.proc?.removeAllListeners('exit');
163
+ this.proc?.kill('SIGINT');
164
+ if (err.code === 'ENOENT') {
165
+ err = await (0, helpers_1.formatEnoent)(err, this.cmd, this.opts?.cwd);
166
+ }
167
+ reject(err);
168
+ this.proc?.unref();
169
+ this.proc = null;
170
+ });
171
+ if (this.proc.stdout) {
172
+ this.proc.stdout.on('data', (chunk) => handleOutput({ stdout: chunk.toString(), stderr: '' }));
173
+ }
174
+ if (this.proc.stderr) {
175
+ this.proc.stderr.on('data', (chunk) => handleOutput({ stdout: '', stderr: chunk.toString() }));
176
+ }
177
+ // when the proc exits, we might still have a buffer of lines we were
178
+ // waiting on more chunks to complete. Go ahead and emit those, then
179
+ // re-emit the exit so a listener can handle the possibly-unexpected exit
180
+ this.proc.on('exit', (code, signal) => {
181
+ this.handleLastLines();
182
+ this.emit('exit', code, signal);
183
+ // in addition to the bare exit event, also emit one of three other
184
+ // events that contain more helpful information:
185
+ // 'stop': we stopped this
186
+ // 'die': the process ended out of our control with a non-zero exit
187
+ // 'end': the process ended out of our control with a zero exit
188
+ let event = this.expectingExit ? 'stop' : 'die';
189
+ if (!this.expectingExit && code === 0) {
190
+ event = 'end';
191
+ }
192
+ this.emit(event, code, signal);
193
+ // finally clean up the proc and make sure to reset our exit
194
+ // expectations
195
+ this.proc = null;
196
+ this.expectingExit = false;
197
+ });
198
+ // if the user hasn't given us a startDetector, instead just resolve
199
+ // when startDelay ms have passed
200
+ if (!startDetector) {
201
+ setTimeout(() => { resolve(); }, startDelay);
202
+ }
203
+ // if the user has given us a timeout, start the clock for rejecting
204
+ // the promise if we take too long to start
205
+ if (lodash_1.default.isNumber(timeoutMs)) {
206
+ setTimeout(() => {
207
+ reject(new Error(`The process did not start within ${timeoutMs}ms ` +
208
+ `(cmd: '${this.rep}')`));
209
+ }, timeoutMs);
210
+ }
211
+ }).finally(() => {
212
+ if (detach && this.proc) {
213
+ this.proc.unref();
214
+ }
215
+ });
216
+ }
217
+ handleLastLines() {
218
+ for (let stream of ['stdout', 'stderr']) {
219
+ if (this.lastLinePortion[stream]) {
220
+ const lastLines = [this.lastLinePortion[stream]];
221
+ this.emit(`lines-${stream}`, lastLines);
222
+ this.emitLines(stream, lastLines);
223
+ this.lastLinePortion[stream] = '';
224
+ }
225
+ }
226
+ }
227
+ /**
228
+ *
229
+ * @param {NodeJS.Signals} signal
230
+ * @param {number} timeout
231
+ * @returns {Promise<void>}
232
+ */
233
+ async stop(signal = 'SIGTERM', timeout = 10000) {
234
+ if (!this.isRunning) {
235
+ throw new Error(`Can't stop process; it's not currently running (cmd: '${this.rep}')`);
236
+ }
237
+ // make sure to emit any data in our lines buffer whenever we're done with
238
+ // the proc
239
+ this.handleLastLines();
240
+ return await new bluebird_1.default((resolve, reject) => {
241
+ this.proc?.on('close', resolve);
242
+ this.expectingExit = true;
243
+ this.proc?.kill(signal);
244
+ // this timeout needs unref() or node will wait for the timeout to fire before
245
+ // exiting the process.
246
+ setTimeout(() => {
247
+ reject(new Error(`Process didn't end after ${timeout}ms (cmd: '${this.rep}')`));
248
+ }, timeout).unref();
249
+ });
250
+ }
251
+ async join(allowedExitCodes = [0]) {
252
+ if (!this.isRunning) {
253
+ throw new Error(`Cannot join process; it is not currently running (cmd: '${this.rep}')`);
254
+ }
255
+ return await new bluebird_1.default((resolve, reject) => {
256
+ this.proc?.on('exit', (code) => {
257
+ if (code !== null && allowedExitCodes.indexOf(code) === -1) {
258
+ reject(new Error(`Process ended with exitcode ${code} (cmd: '${this.rep}')`));
259
+ }
260
+ else {
261
+ resolve(code);
262
+ }
263
+ });
264
+ });
265
+ }
266
+ /*
267
+ * This will only work if the process is created with the `detached` option
268
+ */
269
+ detachProcess() {
270
+ if (!this.opts.detached) {
271
+ // this means that there is a misconfiguration in the calling code
272
+ throw new Error(`Unable to detach process that is not started with 'detached' option`);
273
+ }
274
+ if (this.proc) {
275
+ this.proc.unref();
276
+ }
277
+ }
278
+ get pid() {
279
+ return this.proc ? this.proc.pid : null;
280
+ }
281
+ }
282
+ exports.SubProcess = SubProcess;
283
+ exports.default = SubProcess;
284
+ /**
285
+ * @callback StartDetector
286
+ * @param {string} stdout
287
+ * @param {string} [stderr]
288
+ * @returns {any}
289
+ */
290
+ //# sourceMappingURL=subprocess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess.js","sourceRoot":"","sources":["../../lib/subprocess.js"],"names":[],"mappings":";AAAA,sDAAsD;;;;;;AAEtD,iDAAsC;AACtC,oDAA4B;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAM,CAAC;AAChC,wDAAyB;AACzB,6CAAoC;AACpC,oDAAuB;AACvB,uCAAyC;AAGzC,uCAAuC;AACvC,mDAAmD;AACnD,iBAAiB;AACjB,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC,SAAS,SAAS,CAAE,GAAG,EAAE,YAAY;IACnC,OAAO,GAAG,CAAC,MAAM,GAAG,YAAY;QAC9B,uDAAuD;QACvD,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAGD,MAAM,UAAW,SAAQ,YAAY;IAiCnC;;;;OAIG;IACH,YAAa,GAAG,E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EAAE,CAAC,IAAI,EAAE,EAAE;gBAC7B,IAAI,IAAI,KAAK,IAAI,IAAI,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;oBAC1D,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,IAAI,WAAW,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;iBAC/E;qBAAM;oBACL,OAAO,CAAC,IAAI,CAAC,CAAC;iBACf;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACvB,kEAAkE;YAClE,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;SACxF;QACD,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;CACF;AAEQ,gCAAU;AACnB,kBAAe,UAAU,CAAC;AAE1B;;;;;GAKG"}
package/index.js CHANGED
@@ -1,12 +1 @@
1
- import {install} from 'source-map-support';
2
- install();
3
-
4
- import * as cp from 'child_process';
5
- import * as spIndex from './lib/subprocess';
6
- import * as execIndex from './lib/exec';
7
-
8
- const { spawn } = cp;
9
- const { SubProcess } = spIndex;
10
- const { exec } = execIndex;
11
-
12
- export { exec, spawn, SubProcess };
1
+ module.exports = require('./build/lib');
package/lib/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import {install} from 'source-map-support';
2
+ install();
3
+
4
+ import * as cp from 'child_process';
5
+ import * as spIndex from './subprocess';
6
+ import * as execIndex from './exec';
7
+
8
+ const { spawn } = cp;
9
+ const { SubProcess } = spIndex;
10
+ const { exec } = execIndex;
11
+
12
+ export { exec, spawn, SubProcess };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teen_process",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "A grown up version of Node's spawn/exec",
5
5
  "keywords": [
6
6
  "child_process",
@@ -64,32 +64,36 @@
64
64
  "source-map-support": "0.5.21"
65
65
  },
66
66
  "devDependencies": {
67
- "@appium/eslint-config-appium": "8.0.3",
68
- "@appium/tsconfig": "0.3.0",
69
- "@appium/types": "0.11.1",
67
+ "@appium/eslint-config-appium": "8.0.4",
68
+ "@appium/tsconfig": "0.3.1",
69
+ "@appium/types": "0.13.4",
70
+ "@semantic-release/changelog": "^6.0.1",
71
+ "@semantic-release/git": "^10.0.1",
70
72
  "@types/bluebird": "3.5.38",
71
73
  "@types/chai": "4.3.5",
72
74
  "@types/chai-as-promised": "7.1.5",
73
- "@types/lodash": "4.14.195",
75
+ "@types/lodash": "4.14.197",
74
76
  "@types/mocha": "10.0.1",
75
- "@types/node": "18.16.17",
77
+ "@types/node": "18.17.11",
76
78
  "@types/shell-quote": "1.7.1",
77
- "@types/sinon": "10.0.15",
78
- "@types/source-map-support": "0.5.6",
79
- "@types/ws": "8.5.4",
79
+ "@types/sinon": "10.0.16",
80
+ "@types/source-map-support": "0.5.7",
81
+ "@types/ws": "8.5.5",
80
82
  "chai": "4.3.7",
81
83
  "chai-as-promised": "7.1.1",
82
- "eslint": "8.42.0",
83
- "eslint-config-prettier": "8.8.0",
84
- "eslint-plugin-import": "2.27.5",
84
+ "conventional-changelog-conventionalcommits": "^6.1.0",
85
+ "eslint": "8.47.0",
86
+ "eslint-config-prettier": "8.10.0",
87
+ "eslint-plugin-import": "2.28.1",
85
88
  "eslint-plugin-mocha": "10.1.0",
86
89
  "eslint-plugin-promise": "6.1.1",
87
- "lint-staged": "13.2.2",
90
+ "lint-staged": "13.3.0",
88
91
  "mocha": "10.2.0",
89
92
  "pre-commit": "1.2.2",
90
- "prettier": "2.8.8",
91
- "sinon": "15.1.2",
92
- "typescript": "5.1.3",
93
+ "prettier": "3.0.2",
94
+ "semantic-release": "^21.1.0",
95
+ "sinon": "15.2.0",
96
+ "typescript": "5.1.6",
93
97
  "ts-node": "10.9.1"
94
98
  },
95
99
  "engines": {