https://github.com/Microsoft/TypeScript
Raw File
Tip revision: fb6c8392681f50a305236a7d662123a69827061f authored by TypeScript Bot on 05 April 2021, 18:48:03 UTC
Bump version to 4.2.4 and LKG
Tip revision: fb6c839
run-sequence.js
// @ts-check
const cp = require("child_process");
/**
 * 
 * @param {[string, string[]][]} tasks
 * @param {cp.SpawnSyncOptions} opts
 */
function runSequence(tasks, opts = { timeout: 100000, shell: true }) {
    let lastResult;
    for (const task of tasks) {
        console.log(`${task[0]} ${task[1].join(" ")}`);
        const result = cp.spawnSync(task[0], task[1], opts);
        if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && "stderr: " + result.stderr.toString()}${result.stdout && "\nstdout: " + result.stdout.toString()}`);
        console.log(result.stdout && result.stdout.toString());
        lastResult = result;
    }
    return lastResult && lastResult.stdout && lastResult.stdout.toString();
}

exports.runSequence = runSequence;
back to top