(command, args)
| 8 | * @returns {Promise<void>} promise |
| 9 | */ |
| 10 | const runCommand = (command, args) => { |
| 11 | const cp = require("child_process"); |
| 12 | |
| 13 | return new Promise((resolve, reject) => { |
| 14 | const executedCommand = cp.spawn(command, args, { |
| 15 | stdio: "inherit", |
| 16 | shell: true |
| 17 | }); |
| 18 | |
| 19 | executedCommand.on("error", (error) => { |
| 20 | reject(error); |
| 21 | }); |
| 22 | |
| 23 | executedCommand.on("exit", (code) => { |
| 24 | if (code === 0) { |
| 25 | resolve(); |
| 26 | } else { |
| 27 | reject(); |
| 28 | } |
| 29 | }); |
| 30 | }); |
| 31 | }; |
| 32 | |
| 33 | /** |
| 34 | * @param {string} packageName name of the package |
no test coverage detected