Skip to content

Commit fb7e77e

Browse files
committed
Switch to purescript-posix-types
1 parent 986665f commit fb7e77e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"purescript-maybe": "~0.3.5",
2222
"purescript-exceptions": "~0.3.3",
2323
"purescript-unsafe-coerce": "~0.1.0",
24-
"purescript-node-fs": "~0.9.2"
24+
"purescript-node-fs": "~0.9.2",
25+
"purescript-posix-types": "~0.1.1"
2526
}
2627
}

src/Node/Process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports.onExit = function(callback) {
2020
};
2121
};
2222

23-
exports.onSignal = function(signal) {
23+
exports.onSignalImpl = function(signal) {
2424
return function(callback) {
2525
return function() {
2626
process.on(signal, callback);

src/Node/Process.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module Node.Process
1212
, getEnv
1313
, lookupEnv
1414
, setEnv
15-
, Pid(..)
1615
, pid
1716
, platform
1817
, exit
@@ -31,6 +30,9 @@ import Data.Maybe (Maybe())
3130
import Data.Maybe.Unsafe (fromJust)
3231
import Data.StrMap (StrMap())
3332
import Data.StrMap as StrMap
33+
import Data.Posix (Pid())
34+
import Data.Posix.Signal (Signal())
35+
import Data.Posix.Signal as Signal
3436
import Node.Stream (Readable(), Writable())
3537
import Unsafe.Coerce (unsafeCoerce)
3638

@@ -59,8 +61,11 @@ foreign import onBeforeExit :: forall eff. Eff (process :: PROCESS | eff) Unit -
5961
-- | to exit with.
6062
foreign import onExit :: forall eff. (Int -> Eff (process :: PROCESS | eff) Unit) -> Eff (process :: PROCESS | eff) Unit
6163

64+
foreign import onSignalImpl :: forall eff. String -> Eff (process :: PROCESS | eff) Unit -> Eff (process :: PROCESS | eff) Unit
65+
6266
-- | Install a handler for a particular signal.
63-
foreign import onSignal :: forall eff. String -> Eff (process :: PROCESS | eff) Unit -> Eff (process :: PROCESS | eff) Unit
67+
onSignal :: forall eff. Signal -> Eff (process :: PROCESS | eff) Unit -> Eff (process :: PROCESS | eff) Unit
68+
onSignal sig = onSignalImpl (Signal.toString sig)
6469

6570
-- | Register a callback to run as soon as the current event loop runs to
6671
-- | completion.
@@ -101,11 +106,6 @@ lookupEnv k = StrMap.lookup k <$> getEnv
101106
-- | Set an environment variable.
102107
foreign import setEnv :: forall eff. String -> String -> Eff (process :: PROCESS | eff) Unit
103108

104-
newtype Pid = Pid Int
105-
106-
runPid :: Pid -> Int
107-
runPid (Pid x) = x
108-
109109
pid :: Pid
110110
pid = process.pid
111111

0 commit comments

Comments
 (0)