MCPcopy
hub / github.com/webpack/webpack / runCommand

Function runCommand

bin/webpack.js:10–31  ·  view source on GitHub ↗
(command, args)

Source from the content-addressed store, hash-verified

8 * @returns {Promise<void>} promise
9 */
10const 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

Callers 1

webpack.jsFile · 0.85

Calls 2

resolveFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected