summaryrefslogtreecommitdiff
path: root/desktop/node_modules/@malept/cross-spawn-promise/dist/src
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/node_modules/@malept/cross-spawn-promise/dist/src')
-rw-r--r--desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.d.ts61
-rw-r--r--desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js111
-rw-r--r--desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js.map1
3 files changed, 173 insertions, 0 deletions
diff --git a/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.d.ts b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.d.ts
new file mode 100644
index 0000000..68789ac
--- /dev/null
+++ b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.d.ts
@@ -0,0 +1,61 @@
+/// <reference types="node" />
+import { SpawnOptions } from "child_process";
+export declare type LoggerFunction = (message: string) => void;
+/**
+ * List of string arguments.
+ */
+export declare type CrossSpawnArgs = ReadonlyArray<string> | undefined;
+export declare type CrossSpawnOptions = SpawnOptions & {
+ /**
+ * A `Function` such as `console.log` or `debug(name)` to log some information about the
+ * spawned process.
+ */
+ logger?: LoggerFunction;
+ /**
+ * A callback which mutates the error before it is rethrown. Most commonly, this is used to
+ * augment the error message of `ENOENT` errors to provide a more human-friendly message as to
+ * how to install the missing executable.
+ *
+ * @param error - The error thrown from the `spawn` function
+ * @param hasLogger - Whether `logger` was set
+ */
+ updateErrorCallback?: (error: Error, hasLogger: boolean) => void;
+};
+/**
+ * Wrapper error for when the spawn function itself emits an error.
+ */
+export declare class CrossSpawnError extends Error {
+ originalError: Error;
+ constructor(cmd: string, args: CrossSpawnArgs, originalError: Error, stderr: string);
+}
+/**
+ * Base error class for when a process does not exit with a status code of zero.
+ */
+export declare abstract class ExitError extends Error {
+ cmd: string;
+ args: CrossSpawnArgs;
+ stdout: string;
+ stderr: string;
+ constructor(cmd: string, args: CrossSpawnArgs, message: string, stdout: string, stderr: string);
+}
+/**
+ * The error thrown when a process emits a non-zero exit code.
+ */
+export declare class ExitCodeError extends ExitError {
+ code: number;
+ constructor(cmd: string, args: CrossSpawnArgs, code: number, stdout: string, stderr: string);
+}
+/**
+ * The error thrown when a process exits via a signal.
+ */
+export declare class ExitSignalError extends ExitError {
+ signal: string;
+ constructor(cmd: string, args: CrossSpawnArgs, signal: string, stdout: string, stderr: string);
+}
+/**
+ * A wrapper around `cross-spawn`'s `spawn` function which can optionally log the command executed
+ * and/or change the error object via a callback.
+ *
+ * @param cmd - The command to run
+ */
+export declare function spawn(cmd: string, args?: CrossSpawnArgs, options?: CrossSpawnOptions): Promise<string>;
diff --git a/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js
new file mode 100644
index 0000000..bed7db1
--- /dev/null
+++ b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js
@@ -0,0 +1,111 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.spawn = exports.ExitSignalError = exports.ExitCodeError = exports.ExitError = exports.CrossSpawnError = void 0;
+const cross_spawn_1 = __importDefault(require("cross-spawn"));
+function stringifyCommand(cmd, args) {
+ if (args && Array.isArray(args) && args.length > 0) {
+ return `${cmd} ${args.join(" ")}`;
+ }
+ else {
+ return cmd;
+ }
+}
+/**
+ * Wrapper error for when the spawn function itself emits an error.
+ */
+class CrossSpawnError extends Error {
+ constructor(cmd, args, originalError, stderr) {
+ const fullCommand = stringifyCommand(cmd, args);
+ const errorMessage = originalError.message || originalError;
+ super(`Error executing command (${fullCommand}):\n${errorMessage}\n${stderr}`.trim());
+ this.originalError = originalError;
+ }
+}
+exports.CrossSpawnError = CrossSpawnError;
+/**
+ * Base error class for when a process does not exit with a status code of zero.
+ */
+class ExitError extends Error {
+ constructor(cmd, args, message, stdout, stderr) {
+ super(message);
+ this.cmd = cmd;
+ this.args = args;
+ this.stdout = stdout;
+ this.stderr = stderr;
+ }
+}
+exports.ExitError = ExitError;
+/**
+ * The error thrown when a process emits a non-zero exit code.
+ */
+class ExitCodeError extends ExitError {
+ constructor(cmd, args, code, stdout, stderr) {
+ const fullCommand = stringifyCommand(cmd, args);
+ super(cmd, args, `Command failed with a non-zero return code (${code}):\n${fullCommand}\n${stdout}\n${stderr}`.trim(), stdout, stderr);
+ this.code = code;
+ }
+}
+exports.ExitCodeError = ExitCodeError;
+/**
+ * The error thrown when a process exits via a signal.
+ */
+class ExitSignalError extends ExitError {
+ constructor(cmd, args, signal, stdout, stderr) {
+ const fullCommand = stringifyCommand(cmd, args);
+ super(cmd, args, `Command terminated via a signal (${signal}):\n${fullCommand}\n${stdout}\n${stderr}`.trim(), stdout, stderr);
+ this.signal = signal;
+ }
+}
+exports.ExitSignalError = ExitSignalError;
+/**
+ * A wrapper around `cross-spawn`'s `spawn` function which can optionally log the command executed
+ * and/or change the error object via a callback.
+ *
+ * @param cmd - The command to run
+ */
+async function spawn(cmd, args, options) {
+ if (!options) {
+ options = {};
+ }
+ const { logger, updateErrorCallback, ...spawnOptions } = options;
+ if (logger)
+ logger(`Executing command ${stringifyCommand(cmd, args)}`);
+ return new Promise((resolve, reject) => {
+ let stdout = "";
+ let stderr = "";
+ const process = cross_spawn_1.default(cmd, args, spawnOptions);
+ if (process.stdout) {
+ process.stdout.on("data", (data) => {
+ stdout += data.toString();
+ });
+ }
+ if (process.stderr) {
+ process.stderr.on("data",
+ /* istanbul ignore next */ (data) => {
+ stderr += data.toString();
+ });
+ }
+ process.on("close", (code, signal) => {
+ if (code === 0) {
+ resolve(stdout);
+ }
+ else if (code === null) {
+ reject(new ExitSignalError(cmd, args, signal, stdout, stderr));
+ }
+ else {
+ reject(new ExitCodeError(cmd, args, code, stdout, stderr));
+ }
+ });
+ process.on("error", (err) => {
+ if (updateErrorCallback) {
+ updateErrorCallback(err, !!logger);
+ }
+ reject(new CrossSpawnError(cmd, args, err, stderr));
+ });
+ });
+}
+exports.spawn = spawn;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js.map b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js.map
new file mode 100644
index 0000000..730e0fb
--- /dev/null
+++ b/desktop/node_modules/@malept/cross-spawn-promise/dist/src/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAqC;AA4BrC,SAAS,gBAAgB,CAAC,GAAW,EAAE,IAA4B;IACjE,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAClD,OAAO,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KACnC;SAAM;QACL,OAAO,GAAG,CAAC;KACZ;AACH,CAAC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAGxC,YACE,GAAW,EACX,IAAoB,EACpB,aAAoB,EACpB,MAAc;QAEd,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC;QAC5D,KAAK,CACH,4BAA4B,WAAW,OAAO,YAAY,KAAK,MAAM,EAAE,CAAC,IAAI,EAAE,CAC/E,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF;AAhBD,0CAgBC;AAED;;GAEG;AACH,MAAsB,SAAU,SAAQ,KAAK;IAM3C,YACE,GAAW,EACX,IAAoB,EACpB,OAAe,EACf,MAAc,EACd,MAAc;QAEd,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;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