Does any Node library provide an option to get the owner's name? This is to avoid killing the processes of users in the case of a multiuser system.
Using the below code snippet to kill processes.
const find = require('find-process');
find('name', 'Teams', true).then(function (list) {
var i;
for (i = 0; i < list.length; i++) {
//logger.info(list[i].pid);
process.kill(list[i].pid);
}
});
Does it ensure to return processes of the current user or check username check is required before killing it?
How can the process owner's name be obtained? (As in Similar to C# )
Added on: 3rd August 2021.
Now I see that there are some packages available but restricted to certain OS versions. In this case, I am looking for some way in Windows 10.
- Owner name and/or uid of the logged-in user and process
- Owner name and/or uid of the process to be killed (Whichever the package which returns the required details for the process list)