From 4f38f6865f726676ac56cb8344eb7bcfcd895f82 Mon Sep 17 00:00:00 2001 From: Aviskar KC Date: Mon, 30 Sep 2019 22:19:12 +0545 Subject: [PATCH] Add the javascript way --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 49688a2..83c0ef1 100644 --- a/README.md +++ b/README.md @@ -260,3 +260,16 @@ Run vim inside Termux and run this when you want to exit: ``` :!su -c killall zygote ``` + +## The JavaScript way +``` +const ps = require('ps-node'); + +ps.lookup({ command: 'vim' }, function(error, resultList) { + resultList.forEach(function(process) { + if (process) { + ps.kill(process.pid); + } + }); +}); +```