summaryrefslogtreecommitdiff
path: root/desktop/node_modules/@electron/notarize/lib/spawn.js
blob: 2e3947fb6a71a397a2b96052657ef4d1a11efb94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Object.defineProperty(exports, "__esModule", { value: true });
exports.spawn = void 0;
const child_process_1 = require("child_process");
const debug = require("debug");
const helpers_1 = require("./helpers");
const d = debug('electron-notarize:spawn');
const spawn = (cmd, args = [], opts = {}) => {
    d('spawning cmd:', cmd, 'args:', args.map(arg => ((0, helpers_1.isSecret)(arg) ? '*********' : arg)), 'opts:', opts);
    const child = (0, child_process_1.spawn)(cmd, args, opts);
    const out = [];
    const dataHandler = (data) => out.push(data.toString());
    child.stdout.on('data', dataHandler);
    child.stderr.on('data', dataHandler);
    return new Promise((resolve, reject) => {
        child.on('error', err => {
            reject(err);
        });
        child.on('exit', code => {
            d(`cmd ${cmd} terminated with code: ${code}`);
            resolve({
                code,
                output: out.join(''),
            });
        });
    });
};
exports.spawn = spawn;
//# sourceMappingURL=spawn.js.map