Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (stdout.trim()) {
pids.push(...(stdout.trim().split(/\s+/)));
}
} catch (e) {
if (e.code === 1) {
log.debug(`${appName} is not running. Continuing...`);
return;
}
if (_.isEmpty(pids)) {
log.warn(`pgrep error ${e.code} while detecting whether ${appName} is running. Trying to kill anyway.`);
}
}
if (!_.isEmpty(pids)) {
log.debug(`Using fkill to kill processes: ${pids.join(', ')}`);
try {
await fkill(pids, {force: true});
} catch (ign) {}
}
log.debug(`Using pkill to kill application: ${appName}`);
try {
await pkill(appName, true);
} catch (ign) {}
// wait for all the devices to be shutdown before Continuing
// but only print out the failed ones when they are actually fully failed
let remainingDevices = [];
async function allSimsAreDown () {
remainingDevices = [];
let devices = await getDevices();
devices = _.flatten(_.values(devices));
return _.every(devices, (sim) => {
export async function killApp (instance) {
await fkill(instance.pid)
}
OmxPlayer.prototype.stop = function() {
BasePlayer.prototype.stop.apply(this);
fkill('omxplayer.bin').then(() => console.log('success'), err => console.log(err));
};
app.on('quit', () => {
if (store.has('processPID')) {
fkill(store.get('processPID', {
force: true
}))
store.delete('processPID')
}
})