MCPcopy Index your code
hub / github.com/ampproject/amphtml / execOrThrow

Function execOrThrow

build-system/common/exec.js:75–84  ·  view source on GitHub ↗

* Executes the provided command, piping the parent process' stderr, throwing * an error with the provided message the command fails, and returns the * process object. * @param {string} cmd * @param {string} msg * @return {!Object}

(cmd, msg)

Source from the content-addressed store, hash-verified

73 * @return {!Object}
74 */
75function execOrThrow(cmd, msg) {
76 const p = exec(cmd, {'stdio': ['inherit', 'inherit', 'pipe']});
77 if (p.status && p.status != 0) {
78 log(red('ERROR:'), msg);
79 const error = new Error(p.stderr);
80 error.status = p.status;
81 throw error;
82 }
83 return p;
84}
85
86module.exports = {
87 exec,

Callers 2

typeCheckFunction · 0.85
checkBuildSystemFunction · 0.85

Calls 3

execFunction · 0.85
redFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected