Tabnine Logo For Javascript
execFile
Code IndexAdd Tabnine to your IDE (free)

How to use
execFile
function
in
child_process

Best JavaScript code snippets using child_process.execFile(Showing top 15 results out of 396)

origin: GoogleChromeLabs/ndb

// Tests for specific Node platform features.
function addTests(testRunner) {
 // eslint-disable-next-line
 const {beforeAll, afterAll} = testRunner;
 // eslint-disable-next-line
 const {it, fit, xit} = testRunner;

 xit('--title flag (fails on Node v8.x)', async function() {
  const result = await new Promise(resolve => execFile(
    process.execPath, ['--title=abc', '-p', 'process.title'], (error, stdout, stderr) => {
     resolve(stdout + stderr);
    }));
  expect(result).toBe('abc\n');
 });
}
origin: Flood-UI/flood

execFile('wmic logicaldisk', {
   shell: true,
   maxBuffer: MAX_BUFFER_SIZE,
  }).then(({stdout}) =>
   stdout
    .trim()
    .split('\n')
    .slice(1)
    .map(disk => disk.split(/\s+/))
    .filter(disk => filterMountPoint(disk[1]))
    .map(disk => ({
     size: disk[14],
     used: disk[14] - disk[10],
     avail: disk[10],
     target: disk[1],
    })),
  )
origin: Flood-UI/flood

childProcess.execFile(
 'mediainfo',
 [selectedTorrent.basePath],
origin: Flood-UI/flood

execFile('df -kl | tail -n+2', {
   shell: true,
   maxBuffer: MAX_BUFFER_SIZE,
  }).then(({stdout}) =>
   stdout
    .trim()
    .split('\n')
    .map(disk => disk.split(/\s+/))
    .filter(disk => filterMountPoint(disk[8]))
    .map(([_fs, size, used, avail, _pcent, _iused, _ifree, _piused, target]) => {
     return {
      size: Number.parseInt(size, 10) * 1024,
      used: Number.parseInt(used, 10) * 1024,
      avail: Number.parseInt(avail, 10) * 1024,
      target,
     };
    }),
  )
origin: godaddy/terminus

it('returns 503 once signal received', (done) => {
   let responseAssertionsComplete = false

   // We're only truly finished when the response has been analyzed and the forked http process has exited,
   // freeing up port 8000 for future tests
   execFile('node', ['lib/standalone-tests/terminus.onsignal.fail.js'], (error) => {
    expect(error.signal).to.eql('SIGINT')
    expect(responseAssertionsComplete).to.eql(true)
    done()
   })

   // let the process start up
   setTimeout(() => {
    fetch('http://localhost:8000/health')
     .then(res => {
      expect(res.status).to.eql(503)
      responseAssertionsComplete = true
     })
   }, 300)
  })
origin: godaddy/terminus

it('calls onSendFailureDuringShutdown when sending 503 during shutdown', (done) => {
   let responseAssertionsComplete = false

   // We're only truly finished when the response has been analyzed and the forked http process has exited,
   // freeing up port 8000 for future tests
   execFile('node', ['lib/standalone-tests/terminus.onsendfailureduringshutdown.js'],
    (error, stdout) => {
     expect(error.signal).to.eql('SIGTERM')
     expect(stdout).to.eql('onSendFailureDuringShutdown\n')
     expect(responseAssertionsComplete).to.eql(true)
     done()
    })

   // let the process start up
   setTimeout(() => {
    fetch('http://localhost:8000/health')
     .then(res => {
      expect(res.status).to.eql(503)
      responseAssertionsComplete = true
     })
   }, 300)
  })
origin: lxchuan12/learn-nodejs

cp.execFile(path.join(__dirname, './init.sh'), function(err, stdout, stderr){
  if(err){
    console.log('执行失败');
    console.log(err, stdout, stderr);
  }
  else{
    console.log('执行成功');
    console.log(err, stdout, stderr);
  }
});
origin: depjs/dep

which('git', (e, git) => {
   if (e) return reject(e)
   const args = prefix.concat(cmds)
   execFile(git, args, opt, (e, stdout) => {
    if (e) return reject(e)
    resolve(stdout)
   })
  })
origin: ironSource/node-regedit

describe.skip('json safe stream version', function() {
  it('also escapes windows newline', function(done) {
    cp.execFile('cscript', ['/NoLogo', vbsScript], function(err, stdout, stderr) {
      if (err) {
        return done(err)
      }

      JSON.parse(stdout).a.should.eql('"' + helper.ESCAPED_WIN_EOL + '测试\\')

      done()
    })
  })
})
origin: iximiuz/node-diskusage-ng

function diskusage(path, cb) {
  execFile('df', ['-k', path], function(err, stdout) {
    if (err) {
      return cb(err);
    }

    try {
      cb(null, parse(stdout));
    } catch (e) {
      cb(e);
    }
  });
}
origin: kevinoid/git-branch-is

it('exit code 0 works when executed', (done) => {
  execFile(
   process.execPath,
   [GIT_BRANCH_IS, '-v', BRANCH_CURRENT],
   (err, stdout, stderr) => {
    assert.ifError(err);
    assertMatch(stdout, BRANCH_CURRENT_RE);
    assert.strictEqual(stderr, '');
    done();
   },
  );
 });
origin: wangding/nodejs-demo

cp.execFile(cmd, arg, (err, stdout) => {
 if(err) {
  console.error(err.message);
  process.exit(1);
 }

 console.log(stdout);
});
origin: SkrewEverything/Command-Cache

// Executes scripts for recent and most data. Can execute any script. Splits output line by line and returns
function historyScripts(scriptPath) {
  return new Promise(function (resolve, reject) {
    execFile(scriptPath, (error, stdout, stderr) => {
      if (error) {
        reject(stderr);
      }
      let arr = stdout.split('\n');
      resolve(arr);
    });
  });
}
origin: Flood-UI/flood

// include all mounted file systems by default

const linuxDfParsing = () =>
 execFile('df | tail -n+2', {
  shell: true,
  maxBuffer: MAX_BUFFER_SIZE,
 }).then(({stdout}) =>
  stdout
   .trim()
   .split('\n')
   .map(disk => disk.split(/\s+/))
   .filter(disk => filterMountPoint(disk[5]))
   .map(([_fs, size, used, avail, _pcent, target]) => {
    return {
     size: Number.parseInt(size, 10) * 1024,
     used: Number.parseInt(used, 10) * 1024,
     avail: Number.parseInt(avail, 10) * 1024,
     target,
    };
   }),
 )
origin: godaddy/terminus

it('does NOT call onSendFailureDuringShutdown when sending 503 during failed healthcheck', (done) => {
   let responseAssertionsComplete = false

   // We're only truly finished when the response has been analyzed and the forked http process has exited,
   // freeing up port 8000 for future tests
   execFile('node', ['lib/standalone-tests/terminus.onsendfailureduringshutdown.failed-health.js'],
    (error, stdout) => {
     expect(error.signal).to.eql('SIGTERM')
     // Here, we expect NOT to see "onSendFailureDuringShutdown"
     expect(stdout).to.eql('')
     expect(responseAssertionsComplete).to.eql(true)
     done()
    })

   // let the process start up
   setTimeout(() => {
    fetch('http://localhost:8000/health')
     .then(res => {
      expect(res.status).to.eql(503)
      responseAssertionsComplete = true
     })
   }, 300)
  })
child_processexecFile

Most used child_process functions

  • exec
  • spawn
  • execSync
  • ChildProcess.on
  • ChildProcessWithoutNullStreams.stdout
  • ChildProcessWithoutNullStreams.stderr,
  • fork,
  • ChildProcess.pid,
  • ChildProcess.stdout,
  • ChildProcess.stderr,
  • ChildProcessWithoutNullStreams.kill,
  • spawnSync,
  • ChildProcess.kill,
  • ChildProcessWithoutNullStreams.stdin,
  • ChildProcess.send,
  • ExecException.message,
  • ChildProcess.once,
  • SpawnSyncReturns.status

Popular in JavaScript

  • http
  • async
    Higher-order functions and common patterns for asynchronous code
  • request
    Simplified HTTP request client.
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • body-parser
    Node.js body parsing middleware
  • js-yaml
    YAML 1.2 parser and serializer
  • aws-sdk
    AWS SDK for JavaScript
  • crypto
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now