spawn-rx 5.1.2 → 6.0.1

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.
@@ -1,5 +1,49 @@
1
+ import { type SpawnOptions } from "node:child_process";
2
+ import * as sfs from "node:fs";
1
3
  import { Observable } from "rxjs";
2
- import { SpawnOptions } from "child_process";
4
+ /**
5
+ * Custom error class for spawn operations with additional metadata
6
+ */
7
+ export declare class SpawnError extends Error {
8
+ readonly exitCode: number;
9
+ readonly code: number;
10
+ readonly stdout?: string;
11
+ readonly stderr?: string;
12
+ readonly command: string;
13
+ readonly args: string[];
14
+ constructor(message: string, exitCode: number, command: string, args: string[], stdout?: string, stderr?: string);
15
+ }
16
+ /**
17
+ * Process metadata tracked during execution
18
+ */
19
+ export interface ProcessMetadata {
20
+ pid: number;
21
+ startTime: number;
22
+ command: string;
23
+ args: string[];
24
+ }
25
+ /**
26
+ * stat a file but don't throw if it doesn't exist
27
+ *
28
+ * @param {string} file The path to a file
29
+ * @return {Stats} The stats structure
30
+ *
31
+ * @private
32
+ */
33
+ export declare function statSyncNoException(file: string): sfs.Stats | null;
34
+ /**
35
+ * stat a file but don't throw if it doesn't exist
36
+ *
37
+ * @param {string} file The path to a file
38
+ * @return {Stats} The stats structure
39
+ *
40
+ * @private
41
+ */
42
+ export declare function statNoException(file: string): Promise<sfs.Stats | null>;
43
+ export type CmdWithArgs = {
44
+ cmd: string;
45
+ args: string[];
46
+ };
3
47
  /**
4
48
  * Finds the actual executable and parameters to run on Windows. This method
5
49
  * mimics the POSIX behavior of being able to run scripts as executables by
@@ -16,61 +60,43 @@ import { SpawnOptions } from "child_process";
16
60
  * @property {string} cmd The command to pass to spawn
17
61
  * @property {string[]} args The arguments to pass to spawn
18
62
  */
19
- export declare function findActualExecutable(exe: string, args: string[]): {
20
- cmd: string;
21
- args: string[];
22
- };
63
+ export declare function findActualExecutable(exe: string, args: string[]): CmdWithArgs;
23
64
  export type SpawnRxExtras = {
24
65
  stdin?: Observable<string>;
25
66
  echoOutput?: boolean;
26
67
  split?: boolean;
27
- jobber?: boolean;
28
68
  encoding?: BufferEncoding;
69
+ /**
70
+ * Timeout in milliseconds. If the process doesn't complete within this time,
71
+ * it will be killed and the observable will error with a TimeoutError.
72
+ */
73
+ timeout?: number;
74
+ /**
75
+ * Number of retry attempts if the process fails (non-zero exit code).
76
+ * Defaults to 0 (no retries).
77
+ */
78
+ retries?: number;
79
+ /**
80
+ * Delay in milliseconds between retry attempts. Defaults to 1000ms.
81
+ */
82
+ retryDelay?: number;
29
83
  };
30
84
  export type OutputLine = {
31
85
  source: "stdout" | "stderr";
32
86
  text: string;
33
87
  };
34
88
  /**
35
- * Spawns a process but detached from the current process. The process is put
36
- * into its own Process Group that can be killed by unsubscribing from the
37
- * return Observable.
38
- *
39
- * @param {string} exe The executable to run
40
- * @param {string[]} params The parameters to pass to the child
41
- * @param {SpawnOptions & SpawnRxExtras} opts Options to pass to spawn.
42
- *
43
- * @return {Observable<OutputLine>} Returns an Observable that when subscribed
44
- * to, will create a detached process. The
45
- * process output will be streamed to this
46
- * Observable, and if unsubscribed from, the
47
- * process will be terminated early. If the
48
- * process terminates with a non-zero value,
49
- * the Observable will terminate with onError.
89
+ * Utility type to extract the return type based on split option
50
90
  */
51
- export declare function spawnDetached(exe: string, params: string[], opts: SpawnOptions & SpawnRxExtras & {
91
+ export type SpawnResult<T extends SpawnRxExtras> = T extends {
52
92
  split: true;
53
- }): Observable<OutputLine>;
93
+ } ? Observable<OutputLine> : Observable<string>;
54
94
  /**
55
- * Spawns a process but detached from the current process. The process is put
56
- * into its own Process Group that can be killed by unsubscribing from the
57
- * return Observable.
58
- *
59
- * @param {string} exe The executable to run
60
- * @param {string[]} params The parameters to pass to the child
61
- * @param {SpawnOptions & SpawnRxExtras} opts Options to pass to spawn.
62
- *
63
- * @return {Observable<string>} Returns an Observable that when subscribed
64
- * to, will create a detached process. The
65
- * process output will be streamed to this
66
- * Observable, and if unsubscribed from, the
67
- * process will be terminated early. If the
68
- * process terminates with a non-zero value,
69
- * the Observable will terminate with onError.
95
+ * Utility type to extract the promise return type based on split option
70
96
  */
71
- export declare function spawnDetached(exe: string, params: string[], opts?: SpawnOptions & SpawnRxExtras & {
72
- split: false | undefined;
73
- }): Observable<string>;
97
+ export type SpawnPromiseResult<T extends SpawnRxExtras> = T extends {
98
+ split: true;
99
+ } ? Promise<[string, string]> : Promise<string>;
74
100
  /**
75
101
  * Spawns a process attached as a child of the current process.
76
102
  *
@@ -107,40 +133,6 @@ export declare function spawn(exe: string, params: string[], opts: SpawnOptions
107
133
  export declare function spawn(exe: string, params: string[], opts?: SpawnOptions & SpawnRxExtras & {
108
134
  split: false | undefined;
109
135
  }): Observable<string>;
110
- /**
111
- * Spawns a process but detached from the current process. The process is put
112
- * into its own Process Group.
113
- *
114
- * @param {string} exe The executable to run
115
- * @param {string[]} params The parameters to pass to the child
116
- * @param {SpawnOptions & SpawnRxExtras} opts Options to pass to spawn.
117
- *
118
- * @return {Promise<[string, string]>} Returns an Promise that represents a detached
119
- * process. The value returned is the process
120
- * output. If the process terminates with a
121
- * non-zero value, the Promise will resolve with
122
- * an Error.
123
- */
124
- export declare function spawnDetachedPromise(exe: string, params: string[], opts: SpawnOptions & SpawnRxExtras & {
125
- split: true;
126
- }): Promise<[string, string]>;
127
- /**
128
- * Spawns a process but detached from the current process. The process is put
129
- * into its own Process Group.
130
- *
131
- * @param {string} exe The executable to run
132
- * @param {string[]} params The parameters to pass to the child
133
- * @param {SpawnOptions & SpawnRxExtras} opts Options to pass to spawn.
134
- *
135
- * @return {Promise<string>} Returns an Promise that represents a detached
136
- * process. The value returned is the process
137
- * output. If the process terminates with a
138
- * non-zero value, the Promise will resolve with
139
- * an Error.
140
- */
141
- export declare function spawnDetachedPromise(exe: string, params: string[], opts?: SpawnOptions & SpawnRxExtras & {
142
- split: false | undefined;
143
- }): Promise<string>;
144
136
  /**
145
137
  * Spawns a process as a child process.
146
138
  *
package/lib/index.js ADDED
@@ -0,0 +1,451 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
46
+ var __importDefault = (this && this.__importDefault) || function (mod) {
47
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.SpawnError = void 0;
51
+ exports.statSyncNoException = statSyncNoException;
52
+ exports.statNoException = statNoException;
53
+ exports.findActualExecutable = findActualExecutable;
54
+ exports.spawn = spawn;
55
+ exports.spawnPromise = spawnPromise;
56
+ const node_child_process_1 = require("node:child_process");
57
+ const sfs = __importStar(require("node:fs"));
58
+ const fs = __importStar(require("node:fs/promises"));
59
+ const path = __importStar(require("node:path"));
60
+ const debug_1 = __importDefault(require("debug"));
61
+ const lru_cache_1 = require("lru-cache");
62
+ const rxjs_1 = require("rxjs");
63
+ const operators_1 = require("rxjs/operators");
64
+ const isWindows = process.platform === "win32";
65
+ const d = (0, debug_1.default)("spawn-rx"); // tslint:disable-line:no-var-requires
66
+ /**
67
+ * Custom error class for spawn operations with additional metadata
68
+ */
69
+ class SpawnError extends Error {
70
+ exitCode;
71
+ code;
72
+ stdout;
73
+ stderr;
74
+ command;
75
+ args;
76
+ constructor(message, exitCode, command, args, stdout, stderr) {
77
+ super(message);
78
+ this.name = "SpawnError";
79
+ this.exitCode = exitCode;
80
+ this.code = exitCode;
81
+ this.stdout = stdout;
82
+ this.stderr = stderr;
83
+ this.command = command;
84
+ this.args = args;
85
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
86
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
+ if (Error.captureStackTrace) {
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ Error.captureStackTrace(this, SpawnError);
90
+ }
91
+ }
92
+ }
93
+ exports.SpawnError = SpawnError;
94
+ /**
95
+ * stat a file but don't throw if it doesn't exist
96
+ *
97
+ * @param {string} file The path to a file
98
+ * @return {Stats} The stats structure
99
+ *
100
+ * @private
101
+ */
102
+ function statSyncNoException(file) {
103
+ try {
104
+ return sfs.statSync(file);
105
+ }
106
+ catch (_a) {
107
+ return null;
108
+ }
109
+ }
110
+ /**
111
+ * stat a file but don't throw if it doesn't exist
112
+ *
113
+ * @param {string} file The path to a file
114
+ * @return {Stats} The stats structure
115
+ *
116
+ * @private
117
+ */
118
+ function statNoException(file) {
119
+ return fs.stat(file).catch(() => null);
120
+ }
121
+ /**
122
+ * Cache for resolved executable paths
123
+ */
124
+ const pathCache = new lru_cache_1.LRUCache({ max: 512 });
125
+ /**
126
+ * Search PATH to see if a file exists in any of the path folders.
127
+ *
128
+ * @param {string} exe The file to search for
129
+ * @return {string} A fully qualified path, or the original path if nothing
130
+ * is found
131
+ *
132
+ * @private
133
+ */
134
+ function runDownPath(exe) {
135
+ var _a;
136
+ // Check cache first
137
+ const cached = pathCache.get(exe);
138
+ if (cached !== undefined) {
139
+ d(`Cache hit for executable: ${exe} -> ${cached}`);
140
+ return cached;
141
+ }
142
+ // NB: Windows won't search PATH looking for executables in spawn like
143
+ // Posix does
144
+ // Files with any directory path don't get this applied
145
+ if (exe.match(/[\\/]/)) {
146
+ d("Path has slash in directory, bailing");
147
+ pathCache.set(exe, exe);
148
+ return exe;
149
+ }
150
+ const target = path.join(".", exe);
151
+ if (statSyncNoException(target)) {
152
+ d(`Found executable in current directory: ${target}`);
153
+ // XXX: Some very Odd programs decide to use args[0] as a parameter
154
+ // to determine what to do, and also symlink themselves, so we can't
155
+ // use realpathSync here like we used to
156
+ pathCache.set(exe, target);
157
+ return target;
158
+ }
159
+ const haystack = (_a = process.env.PATH) === null || _a === void 0 ? void 0 : _a.split(isWindows ? ";" : ":");
160
+ if (haystack) {
161
+ for (const p of haystack) {
162
+ const needle = path.join(p, exe);
163
+ if (statSyncNoException(needle)) {
164
+ // NB: Same deal as above
165
+ pathCache.set(exe, needle);
166
+ return needle;
167
+ }
168
+ }
169
+ }
170
+ d("Failed to find executable anywhere in path");
171
+ pathCache.set(exe, exe);
172
+ return exe;
173
+ }
174
+ /**
175
+ * Finds the actual executable and parameters to run on Windows. This method
176
+ * mimics the POSIX behavior of being able to run scripts as executables by
177
+ * replacing the passed-in executable with the script runner, for PowerShell,
178
+ * CMD, and node scripts.
179
+ *
180
+ * This method also does the work of running down PATH, which spawn on Windows
181
+ * also doesn't do, unlike on POSIX.
182
+ *
183
+ * @param {string} exe The executable to run
184
+ * @param {string[]} args The arguments to run
185
+ *
186
+ * @return {Object} The cmd and args to run
187
+ * @property {string} cmd The command to pass to spawn
188
+ * @property {string[]} args The arguments to pass to spawn
189
+ */
190
+ function findActualExecutable(exe, args) {
191
+ // POSIX can just execute scripts directly, no need for silly goosery
192
+ if (process.platform !== "win32") {
193
+ return { cmd: runDownPath(exe), args: args };
194
+ }
195
+ if (!sfs.existsSync(exe)) {
196
+ // NB: When you write something like `surf-client ... -- surf-build` on Windows,
197
+ // a shell would normally convert that to surf-build.cmd, but since it's passed
198
+ // in as an argument, it doesn't happen
199
+ const possibleExts = [".exe", ".bat", ".cmd", ".ps1"];
200
+ for (const ext of possibleExts) {
201
+ const possibleFullPath = runDownPath(`${exe}${ext}`);
202
+ if (sfs.existsSync(possibleFullPath)) {
203
+ return findActualExecutable(possibleFullPath, args);
204
+ }
205
+ }
206
+ }
207
+ if (exe.match(/\.ps1$/i)) {
208
+ const cmd = path.join(process.env.SYSTEMROOT, "System32", "WindowsPowerShell", "v1.0", "PowerShell.exe");
209
+ const psargs = ["-ExecutionPolicy", "Unrestricted", "-NoLogo", "-NonInteractive", "-File", exe];
210
+ return { cmd: cmd, args: psargs.concat(args) };
211
+ }
212
+ if (exe.match(/\.(bat|cmd)$/i)) {
213
+ const cmd = path.join(process.env.SYSTEMROOT, "System32", "cmd.exe");
214
+ const cmdArgs = ["/C", exe, ...args];
215
+ return { cmd: cmd, args: cmdArgs };
216
+ }
217
+ if (exe.match(/\.(js)$/i)) {
218
+ const cmd = process.execPath;
219
+ const nodeArgs = [exe];
220
+ return { cmd: cmd, args: nodeArgs.concat(args) };
221
+ }
222
+ // Dunno lol
223
+ return { cmd: exe, args: args };
224
+ }
225
+ /**
226
+ * Spawns a process attached as a child of the current process.
227
+ *
228
+ * @param {string} exe The executable to run
229
+ * @param {string[]} params The parameters to pass to the child
230
+ * @param {SpawnOptions & SpawnRxExtras} opts Options to pass to spawn.
231
+ *
232
+ * @return {Observable<string>} Returns an Observable that when subscribed
233
+ * to, will create a child process. The
234
+ * process output will be streamed to this
235
+ * Observable, and if unsubscribed from, the
236
+ * process will be terminated early. If the
237
+ * process terminates with a non-zero value,
238
+ * the Observable will terminate with onError.
239
+ */
240
+ function spawn(exe, params, opts) {
241
+ var _a;
242
+ opts = opts !== null && opts !== void 0 ? opts : {};
243
+ const spawnObs = new rxjs_1.Observable((subj) => {
244
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
245
+ const { encoding, timeout } = opts, spawnOpts = __rest(opts, ["encoding", "timeout"]);
246
+ const { cmd, args } = findActualExecutable(exe, params);
247
+ d(`spawning process: ${cmd} ${args.join()}, ${JSON.stringify(spawnOpts)}`);
248
+ const proc = (0, node_child_process_1.spawn)(cmd, args, spawnOpts);
249
+ // Process metadata is tracked but not currently exposed
250
+ // Could be added to SpawnError or returned in a future enhancement
251
+ // const _processMetadata: ProcessMetadata = {
252
+ // pid: proc.pid ?? 0,
253
+ // startTime: Date.now(),
254
+ // command: cmd,
255
+ // args: args,
256
+ // };
257
+ // Set up timeout if specified
258
+ let timeoutHandle = null;
259
+ if (timeout && timeout > 0) {
260
+ timeoutHandle = setTimeout(() => {
261
+ d(`Process timeout reached: ${cmd} ${args.join()}`);
262
+ if (!proc.killed) {
263
+ proc.kill();
264
+ }
265
+ const error = new SpawnError(`Process timed out after ${timeout}ms`, -1, cmd, args);
266
+ subj.error(error);
267
+ }, timeout);
268
+ }
269
+ const bufHandler = (source) => (b) => {
270
+ if (b.length < 1) {
271
+ return;
272
+ }
273
+ if (opts.echoOutput) {
274
+ (source === "stdout" ? process.stdout : process.stderr).write(b);
275
+ }
276
+ let chunk = "<< String sent back was too long >>";
277
+ try {
278
+ if (typeof b === "string") {
279
+ chunk = b.toString();
280
+ }
281
+ else {
282
+ chunk = b.toString(encoding || "utf8");
283
+ }
284
+ }
285
+ catch (_a) {
286
+ chunk = `<< Lost chunk of process output for ${exe} - length was ${b.length}>>`;
287
+ }
288
+ subj.next({ source: source, text: chunk });
289
+ };
290
+ const ret = new rxjs_1.Subscription();
291
+ if (opts.stdin) {
292
+ if (proc.stdin) {
293
+ const stdin = proc.stdin;
294
+ ret.add(opts.stdin.subscribe({
295
+ next: (x) => stdin.write(x),
296
+ error: subj.error.bind(subj),
297
+ complete: () => stdin.end(),
298
+ }));
299
+ }
300
+ else {
301
+ subj.error(new Error(`opts.stdio conflicts with provided spawn opts.stdin observable, 'pipe' is required`));
302
+ }
303
+ }
304
+ let stderrCompleted = null;
305
+ let stdoutCompleted = null;
306
+ let noClose = false;
307
+ if (proc.stdout) {
308
+ stdoutCompleted = new rxjs_1.AsyncSubject();
309
+ proc.stdout.on("data", bufHandler("stdout"));
310
+ proc.stdout.on("close", () => {
311
+ stdoutCompleted.next(true);
312
+ stdoutCompleted.complete();
313
+ });
314
+ }
315
+ else {
316
+ stdoutCompleted = (0, rxjs_1.of)(true);
317
+ }
318
+ if (proc.stderr) {
319
+ stderrCompleted = new rxjs_1.AsyncSubject();
320
+ proc.stderr.on("data", bufHandler("stderr"));
321
+ proc.stderr.on("close", () => {
322
+ stderrCompleted.next(true);
323
+ stderrCompleted.complete();
324
+ });
325
+ }
326
+ else {
327
+ stderrCompleted = (0, rxjs_1.of)(true);
328
+ }
329
+ proc.on("error", (e) => {
330
+ noClose = true;
331
+ if (timeoutHandle) {
332
+ clearTimeout(timeoutHandle);
333
+ }
334
+ subj.error(e);
335
+ });
336
+ proc.on("close", (code) => {
337
+ noClose = true;
338
+ if (timeoutHandle) {
339
+ clearTimeout(timeoutHandle);
340
+ }
341
+ const pipesClosed = (0, rxjs_1.merge)(stdoutCompleted, stderrCompleted).pipe((0, operators_1.reduce)((_acc) => true, true));
342
+ if (code === 0) {
343
+ pipesClosed.subscribe(() => subj.complete());
344
+ }
345
+ else {
346
+ pipesClosed.subscribe(() => {
347
+ const error = new SpawnError(`Process failed with exit code: ${code}`, code, cmd, args);
348
+ subj.error(error);
349
+ });
350
+ }
351
+ });
352
+ ret.add(new rxjs_1.Subscription(() => {
353
+ if (noClose) {
354
+ return;
355
+ }
356
+ if (timeoutHandle) {
357
+ clearTimeout(timeoutHandle);
358
+ }
359
+ d(`Killing process: ${cmd} ${args.join()}`);
360
+ proc.kill();
361
+ }));
362
+ return ret;
363
+ });
364
+ let resultObs = spawnObs;
365
+ // Apply retry logic if specified
366
+ if (opts.retries && opts.retries > 0) {
367
+ const retryCount = opts.retries;
368
+ const delay = (_a = opts.retryDelay) !== null && _a !== void 0 ? _a : 1000;
369
+ resultObs = resultObs.pipe((0, operators_1.retry)({
370
+ count: retryCount,
371
+ delay: (error, retryIndex) => {
372
+ // Only retry on SpawnError with non-zero exit codes
373
+ if (error instanceof SpawnError && error.exitCode !== 0) {
374
+ d(`Retrying process (attempt ${retryIndex + 1}/${retryCount}): ${exe}`);
375
+ return (0, rxjs_1.timer)(delay);
376
+ }
377
+ // Don't retry on other errors
378
+ throw error;
379
+ },
380
+ }));
381
+ }
382
+ return opts.split ? resultObs : resultObs.pipe((0, operators_1.map)((x) => x === null || x === void 0 ? void 0 : x.text));
383
+ }
384
+ function wrapObservableInPromise(obs) {
385
+ return new Promise((res, rej) => {
386
+ let out = "";
387
+ obs.subscribe({
388
+ next: (x) => {
389
+ out += x;
390
+ },
391
+ error: (e) => {
392
+ if (e instanceof SpawnError) {
393
+ const err = new SpawnError(`${out}\n${e.message}`, e.exitCode, e.command, e.args, out, e.stderr);
394
+ rej(err);
395
+ }
396
+ else {
397
+ const err = new Error(`${out}\n${e instanceof Error ? e.message : String(e)}`);
398
+ rej(err);
399
+ }
400
+ },
401
+ complete: () => res(out),
402
+ });
403
+ });
404
+ }
405
+ function wrapObservableInSplitPromise(obs) {
406
+ return new Promise((res, rej) => {
407
+ let out = "";
408
+ let err = "";
409
+ obs.subscribe({
410
+ next: (x) => {
411
+ if (x.source === "stdout") {
412
+ out += x.text;
413
+ }
414
+ else {
415
+ err += x.text;
416
+ }
417
+ },
418
+ error: (e) => {
419
+ if (e instanceof SpawnError) {
420
+ const error = new SpawnError(`${out}\n${e.message}`, e.exitCode, e.command, e.args, out, err);
421
+ rej(error);
422
+ }
423
+ else {
424
+ const error = new Error(`${out}\n${e instanceof Error ? e.message : String(e)}`);
425
+ rej(error);
426
+ }
427
+ },
428
+ complete: () => res([out, err]),
429
+ });
430
+ });
431
+ }
432
+ /**
433
+ * Spawns a process as a child process.
434
+ *
435
+ * @param {string} exe The executable to run
436
+ * @param {string[]} params The parameters to pass to the child
437
+ * @param {Object} opts Options to pass to spawn.
438
+ *
439
+ * @return {Promise<string>} Returns an Promise that represents a child
440
+ * process. The value returned is the process
441
+ * output. If the process terminates with a
442
+ * non-zero value, the Promise will resolve with
443
+ * an Error.
444
+ */
445
+ function spawnPromise(exe, params, opts) {
446
+ if (opts === null || opts === void 0 ? void 0 : opts.split) {
447
+ return wrapObservableInSplitPromise(spawn(exe, params, Object.assign(Object.assign({}, (opts !== null && opts !== void 0 ? opts : {})), { split: true })));
448
+ }
449
+ return wrapObservableInPromise(spawn(exe, params, Object.assign(Object.assign({}, (opts !== null && opts !== void 0 ? opts : {})), { split: false })));
450
+ }
451
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAyE;AACzE,MAAY,GAAG,oCAAgB;AAC/B,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAElC,kDAA0B;AAC1B,yCAAqC;AAErC,+BAAgF;AAChF,8CAA+D;AAE/D,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAE/C,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,UAAU,CAAC,CAAC,CAA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