MCPcopy Index your code
hub / github.com/dcodeIO/webassembly / run

Function run

cli/util.js:8–37  ·  view source on GitHub ↗
(cmd, argv, options)

Source from the content-addressed store, hash-verified

6// Expose utility
7
8function run(cmd, argv, options) {
9 if (!argv)
10 argv = [];
11 var index = 0;
12 while (index < argv.length) {
13 if (argv[index] == null)
14 argv.splice(index, 1);
15 else if (Array.isArray(argv[index])) {
16 if (argv[index].some(item => item == null))
17 argv.splice(index, 1);
18 else
19 Array.prototype.splice.apply(argv, [ index, 1 ].concat(argv[index]));
20 } else
21 ++index;
22 }
23 if (!(options && options.quiet))
24 process.stderr.write(chalk.white.bold(path.basename(cmd)) + " " + argv.map((arg, i) => i === argv.length - 1 || arg.charAt(0) === "-" ? "\n " + arg : arg).join(" ") + "\n\n");
25 return new Promise(function(resolve, reject) {
26 var proc = child_process.spawn(cmd, argv, { stdio: "inherit" });
27 proc.on("close", function(code) {
28 if (code === 0)
29 resolve();
30 else
31 reject(new Error("code " + code));
32 });
33 proc.on("error", function(err) {
34 reject(err);
35 });
36 });
37}
38
39exports.run = run;
40

Callers 3

compiler.jsFile · 0.85
disassembler.jsFile · 0.85
assembler.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected