Skip to content

Commit 7e9400a

Browse files
committed
Update docs
1 parent ef889d5 commit 7e9400a

File tree

1 file changed

+64
-14
lines changed

1 file changed

+64
-14
lines changed

docs/Node/ChildProcess.md

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,102 @@
66
data Handle :: *
77
```
88

9-
#### `Spawn`
9+
A handle for inter-process communication (IPC).
10+
11+
#### `CHILD_PROCESS`
1012

1113
``` purescript
12-
data Spawn :: !
14+
data CHILD_PROCESS :: !
1315
```
1416

15-
#### `Stdin`
17+
The effect for creating and interacting with child processes.
18+
19+
#### `ChildProcess`
1620

1721
``` purescript
18-
data Stdin :: !
22+
newtype ChildProcess
1923
```
2024

21-
#### `Stdout`
25+
#### `stderr`
2226

2327
``` purescript
24-
data Stdout :: !
28+
stderr :: forall eff. ChildProcess -> Readable () (cp :: CHILD_PROCESS | eff) Buffer
2529
```
2630

27-
#### `Stderr`
31+
The standard error stream of a child process. Note that this is only
32+
available if the process was spawned with the stderr option set to "pipe".
33+
34+
#### `stdout`
2835

2936
``` purescript
30-
data Stderr :: !
37+
stdout :: forall eff. ChildProcess -> Readable () (cp :: CHILD_PROCESS | eff) Buffer
3138
```
3239

33-
#### `ChildProcess`
40+
The standard output stream of a child process. Note that this is only
41+
available if the process was spawned with the stdout option set to "pipe".
42+
43+
#### `stdin`
3444

3545
``` purescript
36-
type ChildProcess = { stderr :: forall eff. Readable () (stderr :: Stderr | eff) String, stdin :: forall eff. Writable () (stdin :: Stdin | eff) String, stdout :: forall eff. Readable () (stdout :: Stdout | eff) String, pid :: Number, connected :: Boolean, kill :: forall eff. Fn1 Signal Boolean, send :: forall eff r. Fn2 { | r } Handle (Eff eff Unit), disconnect :: forall eff. Fn0 (Eff eff Unit) }
46+
stdin :: forall eff. ChildProcess -> Writable () (cp :: CHILD_PROCESS | eff) Buffer
3747
```
3848

49+
The standard input stream of a child process. Note that this is only
50+
available if the process was spawned with the stdin option set to "pipe".
51+
52+
#### `pid`
53+
54+
``` purescript
55+
pid :: ChildProcess -> Int
56+
```
57+
58+
The process ID of a child process. Note that if the process has already
59+
exited, another process may have taken the same ID, so be careful!
60+
61+
#### `connected`
62+
63+
``` purescript
64+
connected :: forall eff. ChildProcess -> Eff (cp :: CHILD_PROCESS | eff) Boolean
65+
```
66+
67+
#### `send`
68+
69+
``` purescript
70+
send :: forall eff props. { | props } -> Handle -> ChildProcess -> Eff (cp :: CHILD_PROCESS | eff) Boolean
71+
```
72+
73+
#### `disconnect`
74+
75+
``` purescript
76+
disconnect :: forall eff. ChildProcess -> Eff (cp :: CHILD_PROCESS | eff) Unit
77+
```
78+
79+
#### `kill`
80+
81+
``` purescript
82+
kill :: forall eff. Signal -> ChildProcess -> Eff (cp :: CHILD_PROCESS | eff) Boolean
83+
```
84+
85+
Send a signal to a child process. It's an unfortunate historical decision
86+
that this function is called "kill", as sending a signal to a child
87+
process won't necessarily kill it.
88+
3989
#### `SpawnOptions`
4090

4191
``` purescript
42-
type SpawnOptions = { cwd :: String, stdio :: Array String, env :: forall r. { | r }, detached :: Boolean, uid :: Number, gid :: Number }
92+
type SpawnOptions = { cwd :: String, stdio :: Array String, env :: Nullable (StrMap String), detached :: Boolean, uid :: Int, gid :: Int }
4393
```
4494

4595
#### `onExit`
4696

4797
``` purescript
48-
onExit :: forall eff. ChildProcess -> (Maybe Number -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
98+
onExit :: forall eff. ChildProcess -> (Maybe Int -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
4999
```
50100

51101
#### `onClose`
52102

53103
``` purescript
54-
onClose :: forall eff. ChildProcess -> (Maybe Number -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
104+
onClose :: forall eff. ChildProcess -> (Maybe Int -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
55105
```
56106

57107
#### `onMessage`
@@ -75,7 +125,7 @@ onError :: forall eff. ChildProcess -> (ChildProcessError -> Eff eff Unit) -> Ef
75125
#### `spawn`
76126

77127
``` purescript
78-
spawn :: forall eff. String -> Array String -> SpawnOptions -> Eff (spawn :: Spawn | eff) ChildProcess
128+
spawn :: forall eff. String -> Array String -> SpawnOptions -> Eff (cp :: CHILD_PROCESS | eff) ChildProcess
79129
```
80130

81131
#### `defaultSpawnOptions`

0 commit comments

Comments
 (0)