MCPcopy Index your code
hub / github.com/nodejs/node / spawnPromisified

Function spawnPromisified

test/common/index.js:870–899  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

868}
869
870function spawnPromisified(...args) {
871 const { spawn } = require('child_process');
872 let stderr = '';
873 let stdout = '';
874
875 const child = spawn(...args);
876 child.stderr.setEncoding('utf8');
877 child.stderr.on('data', (data) => { stderr += data; });
878 child.stdout.setEncoding('utf8');
879 child.stdout.on('data', (data) => { stdout += data; });
880
881 return new Promise((resolve, reject) => {
882 child.on('close', (code, signal) => {
883 resolve({
884 code,
885 signal,
886 stderr,
887 stdout,
888 });
889 });
890 child.on('error', (code, signal) => {
891 reject({
892 code,
893 signal,
894 stderr,
895 stdout,
896 });
897 });
898 });
899}
900
901/**
902 * Escape values in a string template literal. On Windows, this function

Calls 6

resolveFunction · 0.70
requireFunction · 0.50
spawnFunction · 0.50
rejectFunction · 0.50
setEncodingMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…