Tabnine Logo For Javascript
ChildProcess.once
Code IndexAdd Tabnine 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

  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • minimatch
    a glob matcher in javascript
  • postcss
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • express
    Fast, unopinionated, minimalist web framework
  • redis
    Redis client library
  • glob
    a little globber
  • crypto
  • http
  • Top Sublime Text 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