How to use ps-node - 8 common examples

To help you get started, we’ve selected a few ps-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github darekf77 / morphi / src / build-tool / index.ts View on Github external
} else if (commandName === 'update:isomorphic') {
      PackagesRecognition.From(process.cwd()).start(true)
      process.exit(0)
    } else if (commandName === 'build:watch') {
      PackagesRecognition.From(process.cwd()).start()
      BrowserCodeCut.resolveAndAddIsomorphicLibs(argsv.slice(4))
      await (new IncrementalBuildProcess()).startAndWatch('isomorphic build (watch)');
      process.stdin.resume();
    } else if (commandName === 'process-info') {
      // A simple pid lookup
      if (!Array.isArray(argsv) || argsv.length < 2) {
        console.log(`To few arguments for process-info function...`);
        process.exit(0)
      }
      const pid = argsv[3];
      ps.lookup({ pid }, function (err, resultList) {
        if (err) {
          throw new Error(err);
        }
        const process = resultList[0];
        if (process) {
          console.log(JSON.stringify(process));
        }
        else {
          console.log(JSON.stringify({}));
        }
      });
    } else if (commandName === '-h' || commandName === '-help' || commandName === '--help') {
      console.log('HELP  - WORK IN PROGRESS')
      console.log('Usage: morphi build   ... ')
      console.log('Where lib(n) is name of included in node_modules isomorphic lib')
      console.log('Example isomorphic libs are: typeorm, ng2-rest, morphi...');
github apiaryio / dredd / test / integration / helpers.js View on Github external
function killAll(pattern, callback) {
  return ps.lookup({ arguments: pattern }, (err, processList) => {
    if (err || !processList.length) { return callback(err); }

    async.each(processList, (processListItem, next) => kill(processListItem.pid, next),
      callback);
  });
}
github gonenduk / late-inspect / index.js View on Github external
function printList() {
  console.log('List of Node.js processes:');

  ps.lookup({ command: 'node' }, (err, resultList) => {
    if (err) {
      console.log('Error getting list:', err);
    } else {
      resultList.forEach((process) => {
        console.log('PID: %s, COMMAND: %s, ARGUMENTS: %s', process.pid, process.command, process.arguments);
      });
    }
  });
}
github hyperledger / caliper / src / comm / monitor / monitor-process.js View on Github external
return new Promise((resolve, reject) => {
        let pids = [];
        ps.lookup(item, (err, resultList) => {
            if (err) {
                logger.error('failed looking the process up: ' + err);
            }
            else {
                for(let i = 0 ; i < resultList.length ; i++) {
                    pids.push(resultList[i].pid);
                }
            }
            resolve(pids);
        });
    });
}
github hyperledger / caliper / packages / caliper-core / lib / master / monitor / monitor-process.js View on Github external
return new Promise((resolve, reject) => {
            let pids = [];
            ps.lookup(item, (err, resultList) => {
                if (err) {
                    Logger.error('failed looking the process up: ' + err);
                } else {
                    for (let i = 0 ; i < resultList.length ; i++) {
                        pids.push(resultList[i].pid);
                    }
                }
                resolve(pids);
            });
        });
    }
github noobaa / noobaa-core / src / util / os_utils.js View on Github external
    const ps_info = await P.fromCallback(callback => ps.lookup({ command: proc }, callback)) || [];
    return ps_info[0] && ps_info[0].ppid;
github noobaa / noobaa-core / src / util / os_utils.js View on Github external
    const ps_info = await P.fromCallback(callback => ps.lookup({ command: proc }, callback)) || [];
    return ps_info[0] && ps_info[0].ppid;
github efoxbr / megacubo / assets / js / core / global.js View on Github external
function isPIDRunning(pid, cb){
    require('ps-node').lookup({
        command: 'megacubo'
    }, (err, resultList) => {
    	if (err && !(Array.isArray(resultList) && resultList.length)) {
	        cb(err, false, resultList)
	    } else {
            cb(null, resultList.some(r => { return r.pid == pid}))
        }
    })
}

ps-node

A process lookup utility

MIT
Latest version published 8 years ago

Package Health Score

53 / 100
Full package analysis

Popular ps-node functions