summaryrefslogtreecommitdiff
path: root/node_modules/@malept/cross-spawn-promise/dist/src/index.js
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
commit726b81b19251674e149ccfbb1abacbd837fc6db0 (patch)
treefbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/@malept/cross-spawn-promise/dist/src/index.js
parent34f0890e175698940d49238097579f44e4d78c89 (diff)
downloadFlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz
FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/@malept/cross-spawn-promise/dist/src/index.js')
-rw-r--r--node_modules/@malept/cross-spawn-promise/dist/src/index.js111
1 files changed, 0 insertions, 111 deletions
diff --git a/node_modules/@malept/cross-spawn-promise/dist/src/index.js b/node_modules/@malept/cross-spawn-promise/dist/src/index.js
deleted file mode 100644
index bed7db1..0000000
--- a/node_modules/@malept/cross-spawn-promise/dist/src/index.js
+++ /dev/null
@@ -1,111 +0,0 @@
-"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