Refactoring
This commit is contained in:
@@ -3,6 +3,11 @@ const fs = require('fs');
|
||||
const net = require('net');
|
||||
const { logger } = require('./logger');
|
||||
|
||||
/**
|
||||
* Browse /proc in order to find the specific pid
|
||||
* @param {number} pid
|
||||
* @returns {*} process stats if any
|
||||
*/
|
||||
function existsInProc(pid) {
|
||||
try {
|
||||
return fs.statSync(`/proc/${pid}`)
|
||||
@@ -24,6 +29,10 @@ function retriveStdoutFromProcFd(pid) {
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Kills a process with a sys-call
|
||||
* @param {number} pid the killed process pid
|
||||
*/
|
||||
async function killProcess(pid) {
|
||||
const res = spawn('kill', [pid])
|
||||
res.on('exit', () => {
|
||||
|
||||
Reference in New Issue
Block a user