Skip to content

Commit 71b832b

Browse files
committed
Update docs
1 parent dbee01d commit 71b832b

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

docs/Node/ChildProcess.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ Send a signal to a child process. It's an unfortunate historical decision
8686
that this function is called "kill", as sending a signal to a child
8787
process won't necessarily kill it.
8888

89+
#### `ChildProcessExit`
90+
91+
``` purescript
92+
data ChildProcessExit
93+
= Normally Int
94+
| BySignal Signal
95+
```
96+
97+
Specifies how a child process exited; normally (with an exit code), or
98+
due to a signal.
99+
100+
##### Instances
101+
``` purescript
102+
Show ChildProcessExit
103+
```
104+
89105
#### `SpawnOptions`
90106

91107
``` purescript
@@ -95,13 +111,13 @@ type SpawnOptions = { cwd :: Maybe String, stdio :: Array (Maybe StdIOBehaviour)
95111
#### `onExit`
96112

97113
``` purescript
98-
onExit :: forall eff. ChildProcess -> (Maybe Int -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
114+
onExit :: forall eff. ChildProcess -> (ChildProcessExit -> Eff eff Unit) -> Eff eff Unit
99115
```
100116

101117
#### `onClose`
102118

103119
``` purescript
104-
onClose :: forall eff. ChildProcess -> (Maybe Int -> Maybe Signal -> Eff eff Unit) -> Eff eff Unit
120+
onClose :: forall eff. ChildProcess -> (ChildProcessExit -> Eff eff Unit) -> Eff eff Unit
105121
```
106122

107123
#### `onMessage`
@@ -128,6 +144,21 @@ onError :: forall eff. ChildProcess -> (ChildProcessError -> Eff eff Unit) -> Ef
128144
spawn :: forall eff. String -> Array String -> SpawnOptions -> Eff (cp :: CHILD_PROCESS | eff) ChildProcess
129145
```
130146

147+
Spawn a child process. Note that, in the event that a child process could
148+
not be spawned (for example, if the executable was not found) this will
149+
not throw an error. Instead, the `ChildProcess` will be created anyway,
150+
but it will immediately emit an 'error' event.
151+
152+
#### `fork`
153+
154+
``` purescript
155+
fork :: forall eff. String -> Array String -> Eff (cp :: CHILD_PROCESS | eff) ChildProcess
156+
```
157+
158+
A special case of `spawn` for creating Node.js child processes. The first
159+
argument is the module to be run, and the second is the argv (command line
160+
arguments).
161+
131162
#### `defaultSpawnOptions`
132163

133164
``` purescript
@@ -146,6 +177,10 @@ An error which occurred inside a child process.
146177

147178
``` purescript
148179
data StdIOBehaviour
180+
= Pipe
181+
| Ignore
182+
| ShareStream (forall r eff a. Stream r eff a)
183+
| ShareFD FileDescriptor
149184
```
150185

151186
Behaviour for standard IO streams (eg, standard input, standard output) of
@@ -161,4 +196,28 @@ a child process.
161196
* `ShareFD`: Connect the supplied file descriptor (which should be open
162197
in the parent) to the corresponding file descriptor in the child.
163198

199+
#### `pipe`
200+
201+
``` purescript
202+
pipe :: Array (Maybe StdIOBehaviour)
203+
```
204+
205+
Create pipes for each of the three standard IO streams.
206+
207+
#### `inherit`
208+
209+
``` purescript
210+
inherit :: Array (Maybe StdIOBehaviour)
211+
```
212+
213+
Share stdin with stdin, stdout with stdout, and stderr with stderr.
214+
215+
#### `ignore`
216+
217+
``` purescript
218+
ignore :: Array (Maybe StdIOBehaviour)
219+
```
220+
221+
Ignore all streams.
222+
164223

0 commit comments

Comments
 (0)