-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make a request to the Anoma client to check if it is running
Querying the pid is error-prone because the pid may refer to a different process.
- Loading branch information
1 parent
732fb54
commit 6b38abe
Showing
3 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
module Juvix.Prelude.Posix where | ||
|
||
import Control.Exception | ||
import Juvix.Prelude.Base | ||
import System.Posix.Signals | ||
|
||
terminateProcessPid :: (MonadIO m, Integral a) => a -> m () | ||
terminateProcessPid = liftIO . signalProcess softwareTermination . fromIntegral | ||
|
||
isProcessRunning :: forall m a. (MonadIO m, Integral a) => a -> m Bool | ||
isProcessRunning pid = do | ||
result <- liftIO (try (signalProcess nullSignal (fromIntegral pid))) :: m (Either SomeException ()) | ||
return (isRight result) |