MCPcopy Create free account
hub / github.com/Azure/powershell / exec

Function exec

lib/index.js:1675–1687  ·  view source on GitHub ↗

* Exec a command. * Output will be streamed to the live console. * Returns promise with return code * * @param commandLine command to execute (can include additional args). Must be correctly escaped. * @param args optional arguments for tool. Escaping is handled by

(commandLine, args, options)

Source from the content-addressed store, hash-verified

1673 * @returns Promise<number> exit code
1674 */
1675function exec(commandLine, args, options) {
1676 return __awaiter(this, void 0, void 0, function* () {
1677 const commandArgs = tr.argStringToArray(commandLine);
1678 if (commandArgs.length === 0) {
1679 throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
1680 }
1681 // Path to tool to execute should be first arg
1682 const toolPath = commandArgs[0];
1683 args = commandArgs.slice(1).concat(args || []);
1684 const runner = new tr.ToolRunner(toolPath, args, options);
1685 return runner.exec();
1686 });
1687}
1688exports.exec = exec;
1689/**
1690 * Exec a command and get the output.

Callers 3

getExecOutputFunction · 0.85
rmRFFunction · 0.85
unzipUsing7ZipMethod · 0.85

Calls 1

execMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…