How to use cross-spawn

Comprehensive cross-spawn code examples:

How to use cross-spawn.spawn:

107
108
109
110
111
112
113
114
115
      debug(`postinstall trigger: ${getPostInstallTrigger()}`)
    })
}

function run(cmd, params, cwd = process.cwd(), stdio = ["pipe", "inherit", "inherit"]) {
  const child = childProcess.spawn(cmd, params, {
    stdio,
    cwd,
  })

How to use cross-spawn.sync:

71
72
73
74
75
76
77
78
79
80
const checkThatNpmCanReadCwd = function ()
{
    const cwd = process.cwd();
    let childOutput = null;
    try {
        childOutput = spawn.sync("npm", ["config", "list"]).output.join("");
    } catch (err) {
        return true;
    }

How to use cross-spawn._parse:

22
23
24
25
26
27
28
29
30
31
32
33


	return env;
};


const handleArgs = (file, args, options = {}) => {
	const parsed = crossSpawn._parse(file, args, options);
	file = parsed.command;
	args = parsed.args;
	options = parsed.options;