How to use the spawnSync function from child_process
Find comprehensive JavaScript child_process.spawnSync code examples handpicked from public code repositorys.
1 2 3 4 5 6 7 8 9 10
const path = require('path'); const proc = require('child_process'); const fs = require('fs'); const findResult = proc.spawnSync('find', ['.', '-iname', '"_*.scss"'], { cwd: __dirname, shell: true, env: process.env, }).stdout.toString();
0
4
4
+ 5 other calls in file
98 99 100 101 102 103 104 105 106 107
cwd: __dirname, encoding: 'utf8', shell: true, }), onComplete: () => spawnSync('yarn', ['run', 'icons:apply'], { cwd: __dirname, encoding: 'utf8', shell: true, }),
967
0
87
+ 3 other calls in file
GitHub: MarcelBolten/phpeggy
24 25 26 27 28 29 30 31 32 33 34
return path.join(__dirname, "fixtures", filename); } } function runPhp(args, stdin) { const result = cp.spawnSync("php", args, { input: stdin || null, encoding: "utf8", }); if (result.error) {
1
4
1
468 469 470 471 472 473 474 475 476 477 478
}); gulp.task('validatePackageLockJson', async () => { const fileName = path.join(__dirname, 'package-lock.json'); const oldContents = fs.readFileSync(fileName).toString(); spawnSync('npm', ['install', '--prefer-offline']); const newContents = fs.readFileSync(fileName).toString(); if (oldContents.trim() !== newContents.trim()) { throw new Error('package-lock.json has changed after running `npm install`'); }
0
4
0
+ 3 other calls in file
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258
execFile('bash', ['/home/revo/nodeutils', '-showmaster'], (errShowMaster, stdoutShowMaster, stderrShowMaster) => { if (errShowMaster) { res.status(404).send(errShowMaster); } else { //let result = execFileSync('bash', ['/home/revo/nodeutils', '-listunspent', stdoutShowMaster.slice(0, stdoutShowMaster.length - 1 )], { encoding: 'utf8' }); let result = spawnSync('bash', ['/home/revo/nodeutils', '-listunspent', stdoutShowMaster.slice(0, stdoutShowMaster.length - 1 )], { encoding: 'utf8' }); let outtext = result.output[1] let outputresult = outtext.replaceAll("\n", ""); res.send(outputresult); }
0
1
1
+ 14 other calls in file
204 205 206 207 208 209 210 211 212 213
log.info("plugin", "Installing dependencies"); if (fs.existsSync(indexFile)) { // Install dependencies let result = childProcess.spawnSync("npm", [ "install" ], { cwd: this.pluginDir, env: { ...process.env, PLAYWRIGHT_BROWSERS_PATH: "../../browsers", // Special handling for read-browser-monitor
0
0
1
GitHub: nstra9x/herond-core
16 17 18 19 20 21 22 23 24 25 26 27
const rootDir = path.resolve(dirName, '..', '..', '..', '..', '..') const herondCoreDir = path.join(rootDir, 'src', 'herond') const run = (cmd, args = []) => { const prog = spawnSync(cmd, args) if (prog.status !== 0) { console.log(prog.stdout && prog.stdout.toString()) console.error(prog.stderr && prog.stderr.toString()) process.exit(1)
0
0
1
+ 2 other calls in file
GitHub: nstra9x/herond-core
88 89 90 91 92 93 94 95 96 97 98 99 100
const util = { runProcess: (cmd, args = [], options = {}) => { Log.command(options.cwd, cmd, args) return spawnSync(cmd, args, options) }, run: (cmd, args = [], options = {}) => { const { continueOnFail, ...cmdOptions } = options
0
0
1
+ 2 other calls in file
child_process.execSync is the most popular function in child_process (240 examples)