* @param {string} command command * @param {string[]} args args * @param {string} description description * @returns {Promise<void>} result
(command, args, description)
| 90 | * @returns {Promise<void>} result |
| 91 | */ |
| 92 | function exec(command, args, description) { |
| 93 | console.log(`Setup: ${description}`); |
| 94 | return new Promise((resolve, reject) => { |
| 95 | const cp = require("child_process").spawn(command, args, { |
| 96 | cwd: root, |
| 97 | stdio: "inherit", |
| 98 | shell: true |
| 99 | }); |
| 100 | |
| 101 | cp.on("error", (error) => { |
| 102 | reject(new Error(`${description} failed with ${error}`)); |
| 103 | }); |
| 104 | cp.on("exit", (exitCode) => { |
| 105 | if (exitCode) { |
| 106 | reject(new Error(`${description} failed with exit code ${exitCode}`)); |
| 107 | } else { |
| 108 | resolve(); |
| 109 | } |
| 110 | }); |
| 111 | }); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * @param {string} command command |
no test coverage detected