We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6ffd22 commit 4d02fe6Copy full SHA for 4d02fe6
library/src/libdaemonjvm/internal/LockProcess.scala
@@ -9,8 +9,11 @@ object LockProcess {
9
class Default extends LockProcess {
10
def pid(): Int =
11
ProcessHandle.current().pid().toInt
12
- def isRunning(pid: Int): Boolean =
13
- ProcessHandle.of(pid).map(p => p.isAlive).orElse(false)
+ def isRunning(pid: Int): Boolean = {
+ val maybeHandle = ProcessHandle.of(pid)
14
+ if (maybeHandle.isEmpty) false
15
+ else maybeHandle.get.isAlive
16
+ }
17
}
18
19
def default: LockProcess =
0 commit comments