openmct/protractor/bin/stop.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

2015-08-10 22:26:25 +00:00
#! /usr/bin/env node
var shell = require("shelljs/global");
var ps = require('psnode');
var S = require('string');
2015-08-11 18:47:52 +00:00
var sleep = require('sleep');
2015-08-10 22:26:25 +00:00
// A simple pid lookup
ps.list(function(err, results) {
results.forEach(function( process ){
//Killing Node
if(S(process.command).contains("node app.js")) {
2015-08-10 22:26:25 +00:00
console.log();
console.log( 'Killing Node: %s', process.command);
ps.kill(process.pid, function(err, stdout) {
if (err) {
throw new Error(err);
}
console.log(stdout);
2015-08-10 22:26:25 +00:00
});
}else if(S(process.command).contains("webdriver")) {
2015-08-10 22:26:25 +00:00
console.log();
console.log( 'Killing WebDriver: %s', process.command);
ps.kill(process.pid, function(err, stdout) {
if (err){
throw new Error(err);
}
console.log(stdout);
});
}else if(S(process.command).contains("protractor")) {
console.log();
console.log( 'Killing Chrome Drive: %s', process.command);
ps.kill(process.pid, function(err, stdout) {
if (err){
throw new Error(err);
}
console.log(stdout);
2015-08-10 22:26:25 +00:00
});
}
});
});