UNPKG
is-running
Version:
latest (2.1.0)
2.1.0
2.0.2
2.0.1
2.0.0
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Test if a process with a given pid is running
github.com/nisaacson/is-running
nisaacson/is-running
is-running
/
index.js
13 lines
(12 loc)
•
274 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
module
.
exports
= function (pid) {
if
(
module
.
exports
.stub !==
module
.
exports
) {
return
module
.
exports
.stub.apply(
this
, arguments); }
try
{
return
process.kill(pid,
0
) }
catch
(e) {
return
e.code ===
'EPERM'
} }
module
.
exports
.stub =
module
.
exports
;