Codota Logo For Javascript
ChildProcess.once
Code IndexAdd Codota to your IDE (free)

How to use
once
function
in
ChildProcess

Best JavaScript code snippets using child_process.ChildProcess.once(Showing top 15 results out of 315)

origin: GoogleChromeLabs/ndb

 p.once('exit', resolve);
 p.once('error', resolve);
});
const result = await Promise.race([finishPromise, this._disconnectPromise]);
origin: bytedance/diat

export function createTestProcess() {
 return new Promise<childProcess.ChildProcess>(resolve => {
  const child = childProcess.fork(kIdleFilePath);

  child.once('message', () => {
   resolve(child);
  });
 });
}
origin: sumanjs/suman

n.once('close', function (code) {
    n.unref();
    console.log('EXIT CODE OF CONTAINER RUN => ', code);
    cb(null, {
     code: code,
     name: name
    });
   });
origin: keymetrics/pmx

it('should catch unhandled promise', function(done) {
  if (process.version.indexOf('v0') > -1) return done()

  var app = forkPromiseException();

  app.once('message', function(data) {
   data.type.should.eql('axm:option:configuration');
   app.once('message', function(data) {
    data.type.should.eql('process:exception');
    data.data.message.should.eql('fail');
    process.kill(app.pid);
    done();
   });
  });
 });
origin: yodaos-project/yoda.js

test('little pony shall catch uncaught error', t => {
 t.plan(1)

 var cp = childProcess.fork(`${__dirname}/executor.js`)
 cp.once('exit', (code, signal) => {
  t.strictEqual(code, 0)
  t.end()
 })
})
origin: sumanjs/suman

const run = function(opts: ISumanOpts){

 const script = path.resolve(__dirname + '/../../scripts/suman-postinstall.sh');

 console.log('\n');
 console.log(' => Suman will run its postinstall routine.');
 console.log('\n');

 const k = cp.spawn(script);

 k.stdout.pipe(process.stdout);
 k.stderr.pipe(process.stderr);

 k.once('close', function (code: number) {
  process.exit(code || 0);
 });


}
origin: JerryC8080/Memeye

// Handle child process's error
  dashboardProcess.once('error', (err) => {

    // Kill child process once it occur error.
    logger.error(`DashboardProcess occur an error: ${err.toString()}`);
    logger.error(`DashboardProcess should be stopping......`);
    dashboardProcess.kill();
  }).once('exit', (code, signal) => {

    // Stop collector while child process exit.
    logger.error(`DashboardProcess exited by code: ${code}`);
    logger.error(`Collector has been stopped.`);
    collector.stop();
  });
origin: uniqpath/dmt

child.once(
  'exit',
  (this._childExitHandler = function(code, signal) {
   child.removeListener('disconnect', this._childDisconnectHandler);
   clearTimeout(this._childDisconnectTimer);

   if (code > 0) {
    this.emit('error', new Error(code > 1 ? constants.findExitCode(code) : "Module '" + this._options.main + "' stopped unexpected"));
   } else {
    this.emit('stopped');
   }
  }.bind(this))
 );
origin: keymetrics/pmx

it('should notify process about error', function(done) {
  var app = forkNotify();

  app.once('message', function(data) {
   data.type.should.eql('process:exception');
   data.data.message.should.eql('hey');
   process.kill(app.pid);
   done();
  });
 });
origin: tmilar/meli-manager

async function launchChrome(loginUrl) {
 console.log(`Waiting for login on: ${loginUrl}`)
 const chrome = await chromeLauncher.launch({
  startingUrl: loginUrl
 })
 console.log('Chrome window opened.')
 chrome.process.once('exit', onAuthAbort)
 return chrome
}
origin: calebboyd/xbin

runBuildCommandAsync (command, args) {
  return new Promise((resolve, reject) => {
   spawn(command, args, {
    cwd: this.src,
    env: this.env,
    stdio: 'ignore'
   })
    .once('error', reject)
    .once('close', resolve)
  })
 }
origin: sumanjs/suman

n.once('close', function (code) {
     n.unref();
     console.log('EXIT CODE FOR FINDING EXISTING CONTAINER => ', code);
     race(null, {
      name: item.name,
      isContainerAlreadyBuilt: !!data,
      containerInfo: data
     });
    });
origin: sumanjs/suman

n.once('close', function (code) {
     n.unref();
     console.log('EXIT CODE OF CONTAINER BUILD => ', code);
     cb(null, {
      name: name,
      code: code
     });
    });
origin: bytedance/diat

export function createTestProcess() {
 return new Promise<childProcess.ChildProcess>(resolve => {
  const child = childProcess.fork(kIdleFilePath);

  child.once('message', () => {
   resolve(child);
  });
 });
}
origin: calebboyd/xbin

runBuildCommandAsync(command, args) {
  return new _bluebird.Promise((resolve, reject) => {
   (0, _child_process.spawn)(command, args, {
    cwd: this.src,
    env: this.env,
    stdio: 'ignore'
   }).once('error', reject).once('close', resolve);
  });
 }
child_processChildProcessonce

Most used child_process functions

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

Popular in JavaScript

  • axios
    Promise based HTTP client for the browser and node.js
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • glob
    a little globber
  • semver
    The semantic version parser used by npm.
  • body-parser
    Node.js body parsing middleware
  • mongodb
    The official MongoDB driver for Node.js
  • async
    Higher-order functions and common patterns for asynchronous code
  • path
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now