Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} 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...');
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);
});
}
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);
});
}
});
}
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);
});
});
}
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);
});
});
}
const ps_info = await P.fromCallback(callback => ps.lookup({ command: proc }, callback)) || [];
return ps_info[0] && ps_info[0].ppid;
const ps_info = await P.fromCallback(callback => ps.lookup({ command: proc }, callback)) || [];
return ps_info[0] && ps_info[0].ppid;
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}))
}
})
}