spawn-rx 2.0.9 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.travis.yml +24 -24
- package/CODE_OF_CONDUCT.md +50 -50
- package/COPYING +7 -7
- package/README.md +187 -187
- package/appveyor.yml +21 -21
- package/build.cmd +1 -1
- package/build.sh +2 -2
- package/esdoc.json +26 -26
- package/lib/src/index.d.ts +84 -88
- package/lib/src/index.js +306 -301
- package/lib/src/index.js.map +1 -1
- package/package.json +15 -14
- package/src/index.ts +334 -336
- package/test/asserttest.ts +15 -15
- package/test/spawn.ts +102 -102
- package/test/support.ts +14 -14
- package/tsconfig.json +28 -31
- package/tslint.json +39 -37
- package/.npmignore +0 -3
- package/lib/index.js +0 -352
package/.travis.yml
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
sudo: required
|
2
|
-
dist: trusty
|
3
|
-
os:
|
4
|
-
- linux
|
5
|
-
- osx
|
6
|
-
cache:
|
7
|
-
directories:
|
8
|
-
- node_modules
|
9
|
-
notifications:
|
10
|
-
email: false
|
11
|
-
language: node_js
|
12
|
-
node_js:
|
13
|
-
- 7
|
14
|
-
- 6
|
15
|
-
- 4
|
16
|
-
install:
|
17
|
-
- npm install
|
18
|
-
branches:
|
19
|
-
only:
|
20
|
-
- master
|
21
|
-
before_script:
|
22
|
-
- npm prune
|
23
|
-
script:
|
24
|
-
- npm run build
|
1
|
+
sudo: required
|
2
|
+
dist: trusty
|
3
|
+
os:
|
4
|
+
- linux
|
5
|
+
- osx
|
6
|
+
cache:
|
7
|
+
directories:
|
8
|
+
- node_modules
|
9
|
+
notifications:
|
10
|
+
email: false
|
11
|
+
language: node_js
|
12
|
+
node_js:
|
13
|
+
- 7
|
14
|
+
- 6
|
15
|
+
- 4
|
16
|
+
install:
|
17
|
+
- npm install
|
18
|
+
branches:
|
19
|
+
only:
|
20
|
+
- master
|
21
|
+
before_script:
|
22
|
+
- npm prune
|
23
|
+
script:
|
24
|
+
- npm run build
|
package/CODE_OF_CONDUCT.md
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at paul@paulbetts.org. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
|
45
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
46
|
-
version 1.3.0, available at
|
47
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
48
|
-
|
49
|
-
[homepage]: http://contributor-covenant.org
|
50
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at paul@paulbetts.org. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
46
|
+
version 1.3.0, available at
|
47
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
48
|
+
|
49
|
+
[homepage]: http://contributor-covenant.org
|
50
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
package/COPYING
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
Copyright (c) 2016 Paul Betts
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2016 Paul Betts
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
@@ -1,187 +1,187 @@
|
|
1
|
-
# spawn-rx: A better version of spawn
|
2
|
-
|
3
|
-
| Linux/OSX | Windows |
|
4
|
-
| --- | --- |
|
5
|
-
| [![Build Status](https://travis-ci.org/tools-rx/spawn-rx.svg?branch=master)](https://travis-ci.org/tools-rx/spawn-rx) | [![Build status](https://ci.appveyor.com/api/projects/status/xm9xpgma4jwy3xns?svg=true)](https://ci.appveyor.com/project/dfbaskin/spawn-rx) |
|
6
|
-
|
7
|
-
`spawn-rx` is a package that adds an Observable as well as a Promise version of
|
8
|
-
the `child_process.spawn` API, and fixes some deficiencies in `spawn` that come
|
9
|
-
up especially on Windows. For example:
|
10
|
-
|
11
|
-
* `spawn` searches PATH on POSIX platforms but will not on Windows, you need to
|
12
|
-
provide an exact path. spawn-rx makes Windows act like other platforms.
|
13
|
-
|
14
|
-
* On Windows, `{detached: true}` doesn't actually create a process group properly.
|
15
|
-
`spawn-rx` provides a `spawnDetached` method that allows you to spawn a detached
|
16
|
-
process and kill the entire process group if needed.
|
17
|
-
|
18
|
-
* POSIX platforms allow you to directly execute scripts that have a shebang at
|
19
|
-
the top of the file, whereas Windows can only natively `spawn` EXE files, which
|
20
|
-
makes executing npm binaries annoying. `spawn-rx` automatically rewrites your
|
21
|
-
`cmd` and `args` parameters for CMD scripts, PowerShell scripts, and node.js
|
22
|
-
files.
|
23
|
-
|
24
|
-
## Examples
|
25
|
-
|
26
|
-
spawn-as-promise:
|
27
|
-
|
28
|
-
```js
|
29
|
-
// Will run down path to find C:\Windows\System32\wmic.exe, whereas normal
|
30
|
-
// 'spawn' would require an absolute path.
|
31
|
-
spawnPromise('wmic', [])
|
32
|
-
.then((result) => console.log(result));
|
33
|
-
```
|
34
|
-
|
35
|
-
Handle failed processes as errors:
|
36
|
-
|
37
|
-
```js
|
38
|
-
try {
|
39
|
-
await spawnPromise('exit', ['-1']);
|
40
|
-
} catch (e) {
|
41
|
-
console.log("Processes that return non-zero exit codes throw")
|
42
|
-
}
|
43
|
-
```
|
44
|
-
|
45
|
-
Kill running process trees:
|
46
|
-
|
47
|
-
```js
|
48
|
-
let disp = spawnDetached('takesALongTime', []).subscribe();
|
49
|
-
await Promise.delay(1000);
|
50
|
-
|
51
|
-
// Kill the process and its children by unsubscribing.
|
52
|
-
disp.dispose();
|
53
|
-
```
|
54
|
-
|
55
|
-
Stream process output:
|
56
|
-
|
57
|
-
```js
|
58
|
-
spawn('ls', ['-r'])
|
59
|
-
.subscribe(
|
60
|
-
(x) => console.log(x),
|
61
|
-
(e) => console.log("Process exited with an error"));
|
62
|
-
```
|
63
|
-
|
64
|
-
Execute scripts:
|
65
|
-
|
66
|
-
```js
|
67
|
-
// Executes ./node_modules/.bin/uuid.cmd on Windows if invoked via `npm run`
|
68
|
-
let result = await spawnPromise('uuid');
|
69
|
-
```
|
70
|
-
|
71
|
-
|
72
|
-
## What's Jobber?
|
73
|
-
|
74
|
-
Jobber is a Windows executable that will execute a command in a process group,
|
75
|
-
and if signaled via a named pipe, will terminate that process group. It's used
|
76
|
-
in the implementation of `spawnDetached`.
|
77
|
-
|
78
|
-
## Spawn output
|
79
|
-
|
80
|
-
By default spawn will merge stdout and stderr into the returned observable.
|
81
|
-
You can exclude one or the other by passing `ignore` in the `stdio` option of spawn.
|
82
|
-
|
83
|
-
Alternatively if you call it with `{ split: true }` option, the observable output
|
84
|
-
will be an object `{ source: 'stdout', text: '...' }` so you can distinguish
|
85
|
-
the outputs.
|
86
|
-
|
87
|
-
## Stdin support
|
88
|
-
|
89
|
-
If you provide an `observable<string>` in `opts.stdin`, it'll be subscribed upon
|
90
|
-
and fed into the child process stdin. Its completion will terminate stdin stream.
|
91
|
-
|
92
|
-
## Methods
|
93
|
-
|
94
|
-
```js
|
95
|
-
/**
|
96
|
-
* Spawns a process attached as a child of the current process.
|
97
|
-
*
|
98
|
-
* @param {string} exe The executable to run
|
99
|
-
* @param {Array<string>} params The parameters to pass to the child
|
100
|
-
* @param {Object} opts Options to pass to spawn.
|
101
|
-
*
|
102
|
-
* @return {Observable<string>} Returns an Observable that when subscribed
|
103
|
-
* to, will create a child process. The
|
104
|
-
* process output will be streamed to this
|
105
|
-
* Observable, and if unsubscribed from, the
|
106
|
-
* process will be terminated early. If the
|
107
|
-
* process terminates with a non-zero value,
|
108
|
-
* the Observable will terminate with onError.
|
109
|
-
*/
|
110
|
-
function spawn(exe, params=[], opts=null)
|
111
|
-
```
|
112
|
-
|
113
|
-
```js
|
114
|
-
/**
|
115
|
-
* Spawns a process but detached from the current process. The process is put
|
116
|
-
* into its own Process Group that can be killed by unsubscribing from the
|
117
|
-
* return Observable.
|
118
|
-
*
|
119
|
-
* @param {string} exe The executable to run
|
120
|
-
* @param {Array<string>} params The parameters to pass to the child
|
121
|
-
* @param {Object} opts Options to pass to spawn.
|
122
|
-
*
|
123
|
-
* @return {Observable<string>} Returns an Observable that when subscribed
|
124
|
-
* to, will create a detached process. The
|
125
|
-
* process output will be streamed to this
|
126
|
-
* Observable, and if unsubscribed from, the
|
127
|
-
* process will be terminated early. If the
|
128
|
-
* process terminates with a non-zero value,
|
129
|
-
* the Observable will terminate with onError.
|
130
|
-
*/
|
131
|
-
function spawnDetached(exe, params, opts=null)
|
132
|
-
```
|
133
|
-
|
134
|
-
```js
|
135
|
-
/**
|
136
|
-
* Spawns a process as a child process.
|
137
|
-
*
|
138
|
-
* @param {string} exe The executable to run
|
139
|
-
* @param {Array<string>} params The parameters to pass to the child
|
140
|
-
* @param {Object} opts Options to pass to spawn.
|
141
|
-
*
|
142
|
-
* @return {Promise<string>} Returns an Promise that represents a child
|
143
|
-
* process. The value returned is the process
|
144
|
-
* output. If the process terminates with a
|
145
|
-
* non-zero value, the Promise will resolve with
|
146
|
-
* an Error.
|
147
|
-
*/
|
148
|
-
function spawnPromise(exe, params, opts=null)
|
149
|
-
```
|
150
|
-
|
151
|
-
```js
|
152
|
-
/**
|
153
|
-
* Spawns a process but detached from the current process. The process is put
|
154
|
-
* into its own Process Group.
|
155
|
-
*
|
156
|
-
* @param {string} exe The executable to run
|
157
|
-
* @param {Array<string>} params The parameters to pass to the child
|
158
|
-
* @param {Object} opts Options to pass to spawn.
|
159
|
-
*
|
160
|
-
* @return {Promise<string>} Returns an Promise that represents a detached
|
161
|
-
* process. The value returned is the process
|
162
|
-
* output. If the process terminates with a
|
163
|
-
* non-zero value, the Promise will resolve with
|
164
|
-
* an Error.
|
165
|
-
*/
|
166
|
-
function spawnDetachedPromise(exe, params, opts=null)
|
167
|
-
```
|
168
|
-
|
169
|
-
```js
|
170
|
-
/**
|
171
|
-
* Finds the actual executable and parameters to run on Windows. This method
|
172
|
-
* mimics the POSIX behavior of being able to run scripts as executables by
|
173
|
-
* replacing the passed-in executable with the script runner, for PowerShell,
|
174
|
-
* CMD, and node scripts.
|
175
|
-
*
|
176
|
-
* This method also does the work of running down PATH, which spawn on Windows
|
177
|
-
* also doesn't do, unlike on POSIX.
|
178
|
-
*
|
179
|
-
* @param {string} exe The executable to run
|
180
|
-
* @param {Array<string>} args The arguments to run
|
181
|
-
*
|
182
|
-
* @return {Object} The cmd and args to run
|
183
|
-
* @property {string} cmd The command to pass to spawn
|
184
|
-
* @property {Array<string>} args The arguments to pass to spawn
|
185
|
-
*/
|
186
|
-
function findActualExecutable(exe, args)
|
187
|
-
```
|
1
|
+
# spawn-rx: A better version of spawn
|
2
|
+
|
3
|
+
| Linux/OSX | Windows |
|
4
|
+
| --- | --- |
|
5
|
+
| [![Build Status](https://travis-ci.org/tools-rx/spawn-rx.svg?branch=master)](https://travis-ci.org/tools-rx/spawn-rx) | [![Build status](https://ci.appveyor.com/api/projects/status/xm9xpgma4jwy3xns?svg=true)](https://ci.appveyor.com/project/dfbaskin/spawn-rx) |
|
6
|
+
|
7
|
+
`spawn-rx` is a package that adds an Observable as well as a Promise version of
|
8
|
+
the `child_process.spawn` API, and fixes some deficiencies in `spawn` that come
|
9
|
+
up especially on Windows. For example:
|
10
|
+
|
11
|
+
* `spawn` searches PATH on POSIX platforms but will not on Windows, you need to
|
12
|
+
provide an exact path. spawn-rx makes Windows act like other platforms.
|
13
|
+
|
14
|
+
* On Windows, `{detached: true}` doesn't actually create a process group properly.
|
15
|
+
`spawn-rx` provides a `spawnDetached` method that allows you to spawn a detached
|
16
|
+
process and kill the entire process group if needed.
|
17
|
+
|
18
|
+
* POSIX platforms allow you to directly execute scripts that have a shebang at
|
19
|
+
the top of the file, whereas Windows can only natively `spawn` EXE files, which
|
20
|
+
makes executing npm binaries annoying. `spawn-rx` automatically rewrites your
|
21
|
+
`cmd` and `args` parameters for CMD scripts, PowerShell scripts, and node.js
|
22
|
+
files.
|
23
|
+
|
24
|
+
## Examples
|
25
|
+
|
26
|
+
spawn-as-promise:
|
27
|
+
|
28
|
+
```js
|
29
|
+
// Will run down path to find C:\Windows\System32\wmic.exe, whereas normal
|
30
|
+
// 'spawn' would require an absolute path.
|
31
|
+
spawnPromise('wmic', [])
|
32
|
+
.then((result) => console.log(result));
|
33
|
+
```
|
34
|
+
|
35
|
+
Handle failed processes as errors:
|
36
|
+
|
37
|
+
```js
|
38
|
+
try {
|
39
|
+
await spawnPromise('exit', ['-1']);
|
40
|
+
} catch (e) {
|
41
|
+
console.log("Processes that return non-zero exit codes throw")
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
Kill running process trees:
|
46
|
+
|
47
|
+
```js
|
48
|
+
let disp = spawnDetached('takesALongTime', []).subscribe();
|
49
|
+
await Promise.delay(1000);
|
50
|
+
|
51
|
+
// Kill the process and its children by unsubscribing.
|
52
|
+
disp.dispose();
|
53
|
+
```
|
54
|
+
|
55
|
+
Stream process output:
|
56
|
+
|
57
|
+
```js
|
58
|
+
spawn('ls', ['-r'])
|
59
|
+
.subscribe(
|
60
|
+
(x) => console.log(x),
|
61
|
+
(e) => console.log("Process exited with an error"));
|
62
|
+
```
|
63
|
+
|
64
|
+
Execute scripts:
|
65
|
+
|
66
|
+
```js
|
67
|
+
// Executes ./node_modules/.bin/uuid.cmd on Windows if invoked via `npm run`
|
68
|
+
let result = await spawnPromise('uuid');
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
## What's Jobber?
|
73
|
+
|
74
|
+
Jobber is a Windows executable that will execute a command in a process group,
|
75
|
+
and if signaled via a named pipe, will terminate that process group. It's used
|
76
|
+
in the implementation of `spawnDetached`.
|
77
|
+
|
78
|
+
## Spawn output
|
79
|
+
|
80
|
+
By default spawn will merge stdout and stderr into the returned observable.
|
81
|
+
You can exclude one or the other by passing `ignore` in the `stdio` option of spawn.
|
82
|
+
|
83
|
+
Alternatively if you call it with `{ split: true }` option, the observable output
|
84
|
+
will be an object `{ source: 'stdout', text: '...' }` so you can distinguish
|
85
|
+
the outputs.
|
86
|
+
|
87
|
+
## Stdin support
|
88
|
+
|
89
|
+
If you provide an `observable<string>` in `opts.stdin`, it'll be subscribed upon
|
90
|
+
and fed into the child process stdin. Its completion will terminate stdin stream.
|
91
|
+
|
92
|
+
## Methods
|
93
|
+
|
94
|
+
```js
|
95
|
+
/**
|
96
|
+
* Spawns a process attached as a child of the current process.
|
97
|
+
*
|
98
|
+
* @param {string} exe The executable to run
|
99
|
+
* @param {Array<string>} params The parameters to pass to the child
|
100
|
+
* @param {Object} opts Options to pass to spawn.
|
101
|
+
*
|
102
|
+
* @return {Observable<string>} Returns an Observable that when subscribed
|
103
|
+
* to, will create a child process. The
|
104
|
+
* process output will be streamed to this
|
105
|
+
* Observable, and if unsubscribed from, the
|
106
|
+
* process will be terminated early. If the
|
107
|
+
* process terminates with a non-zero value,
|
108
|
+
* the Observable will terminate with onError.
|
109
|
+
*/
|
110
|
+
function spawn(exe, params=[], opts=null)
|
111
|
+
```
|
112
|
+
|
113
|
+
```js
|
114
|
+
/**
|
115
|
+
* Spawns a process but detached from the current process. The process is put
|
116
|
+
* into its own Process Group that can be killed by unsubscribing from the
|
117
|
+
* return Observable.
|
118
|
+
*
|
119
|
+
* @param {string} exe The executable to run
|
120
|
+
* @param {Array<string>} params The parameters to pass to the child
|
121
|
+
* @param {Object} opts Options to pass to spawn.
|
122
|
+
*
|
123
|
+
* @return {Observable<string>} Returns an Observable that when subscribed
|
124
|
+
* to, will create a detached process. The
|
125
|
+
* process output will be streamed to this
|
126
|
+
* Observable, and if unsubscribed from, the
|
127
|
+
* process will be terminated early. If the
|
128
|
+
* process terminates with a non-zero value,
|
129
|
+
* the Observable will terminate with onError.
|
130
|
+
*/
|
131
|
+
function spawnDetached(exe, params, opts=null)
|
132
|
+
```
|
133
|
+
|
134
|
+
```js
|
135
|
+
/**
|
136
|
+
* Spawns a process as a child process.
|
137
|
+
*
|
138
|
+
* @param {string} exe The executable to run
|
139
|
+
* @param {Array<string>} params The parameters to pass to the child
|
140
|
+
* @param {Object} opts Options to pass to spawn.
|
141
|
+
*
|
142
|
+
* @return {Promise<string>} Returns an Promise that represents a child
|
143
|
+
* process. The value returned is the process
|
144
|
+
* output. If the process terminates with a
|
145
|
+
* non-zero value, the Promise will resolve with
|
146
|
+
* an Error.
|
147
|
+
*/
|
148
|
+
function spawnPromise(exe, params, opts=null)
|
149
|
+
```
|
150
|
+
|
151
|
+
```js
|
152
|
+
/**
|
153
|
+
* Spawns a process but detached from the current process. The process is put
|
154
|
+
* into its own Process Group.
|
155
|
+
*
|
156
|
+
* @param {string} exe The executable to run
|
157
|
+
* @param {Array<string>} params The parameters to pass to the child
|
158
|
+
* @param {Object} opts Options to pass to spawn.
|
159
|
+
*
|
160
|
+
* @return {Promise<string>} Returns an Promise that represents a detached
|
161
|
+
* process. The value returned is the process
|
162
|
+
* output. If the process terminates with a
|
163
|
+
* non-zero value, the Promise will resolve with
|
164
|
+
* an Error.
|
165
|
+
*/
|
166
|
+
function spawnDetachedPromise(exe, params, opts=null)
|
167
|
+
```
|
168
|
+
|
169
|
+
```js
|
170
|
+
/**
|
171
|
+
* Finds the actual executable and parameters to run on Windows. This method
|
172
|
+
* mimics the POSIX behavior of being able to run scripts as executables by
|
173
|
+
* replacing the passed-in executable with the script runner, for PowerShell,
|
174
|
+
* CMD, and node scripts.
|
175
|
+
*
|
176
|
+
* This method also does the work of running down PATH, which spawn on Windows
|
177
|
+
* also doesn't do, unlike on POSIX.
|
178
|
+
*
|
179
|
+
* @param {string} exe The executable to run
|
180
|
+
* @param {Array<string>} args The arguments to run
|
181
|
+
*
|
182
|
+
* @return {Object} The cmd and args to run
|
183
|
+
* @property {string} cmd The command to pass to spawn
|
184
|
+
* @property {Array<string>} args The arguments to pass to spawn
|
185
|
+
*/
|
186
|
+
function findActualExecutable(exe, args)
|
187
|
+
```
|
package/appveyor.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
platform:
|
3
|
-
- x64
|
4
|
-
|
5
|
-
cache:
|
6
|
-
- node_modules
|
7
|
-
|
8
|
-
environment:
|
9
|
-
matrix:
|
10
|
-
- nodejs_version: "7"
|
11
|
-
- nodejs_version: "6"
|
12
|
-
- nodejs_version: "4"
|
13
|
-
|
14
|
-
install:
|
15
|
-
- ps: Install-Product node $env:nodejs_version $env:platform
|
16
|
-
- npm install
|
17
|
-
|
18
|
-
test_script:
|
19
|
-
- npm run build
|
20
|
-
|
21
|
-
build: off
|
1
|
+
|
2
|
+
platform:
|
3
|
+
- x64
|
4
|
+
|
5
|
+
cache:
|
6
|
+
- node_modules
|
7
|
+
|
8
|
+
environment:
|
9
|
+
matrix:
|
10
|
+
- nodejs_version: "7"
|
11
|
+
- nodejs_version: "6"
|
12
|
+
- nodejs_version: "4"
|
13
|
+
|
14
|
+
install:
|
15
|
+
- ps: Install-Product node $env:nodejs_version $env:platform
|
16
|
+
- npm install
|
17
|
+
|
18
|
+
test_script:
|
19
|
+
- npm run build
|
20
|
+
|
21
|
+
build: off
|
package/build.cmd
CHANGED
@@ -1 +1 @@
|
|
1
|
-
npm i && npm t
|
1
|
+
npm i && npm t
|
package/build.sh
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
npm i && npm t
|
1
|
+
#!/bin/bash
|
2
|
+
npm i && npm t
|
package/esdoc.json
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
{
|
2
|
-
"source": "./src",
|
3
|
-
"destination": "./docs",
|
4
|
-
"includes": ["\\.(js|es6)$"],
|
5
|
-
"excludes": ["\\.config\\.(js|es6)$"],
|
6
|
-
"access": ["public", "protected"],
|
7
|
-
"autoPrivate": true,
|
8
|
-
"unexportIdentifier": false,
|
9
|
-
"undocumentIdentifier": true,
|
10
|
-
"builtinExternal": true,
|
11
|
-
"index": "./README.md",
|
12
|
-
"package": "./package.json",
|
13
|
-
"coverage": true,
|
14
|
-
"includeSource": true,
|
15
|
-
"title": "electron-compilers",
|
16
|
-
"plugins": [
|
17
|
-
{"name": "esdoc-es7-plugin"},
|
18
|
-
{"name": "esdoc-plugin-async-to-sync"}
|
19
|
-
],
|
20
|
-
"test": {
|
21
|
-
"type": "mocha",
|
22
|
-
"source": "./test",
|
23
|
-
"includes": ["\\.(js|es6)$"]
|
24
|
-
},
|
25
|
-
"lint": true
|
26
|
-
}
|
1
|
+
{
|
2
|
+
"source": "./src",
|
3
|
+
"destination": "./docs",
|
4
|
+
"includes": ["\\.(js|es6)$"],
|
5
|
+
"excludes": ["\\.config\\.(js|es6)$"],
|
6
|
+
"access": ["public", "protected"],
|
7
|
+
"autoPrivate": true,
|
8
|
+
"unexportIdentifier": false,
|
9
|
+
"undocumentIdentifier": true,
|
10
|
+
"builtinExternal": true,
|
11
|
+
"index": "./README.md",
|
12
|
+
"package": "./package.json",
|
13
|
+
"coverage": true,
|
14
|
+
"includeSource": true,
|
15
|
+
"title": "electron-compilers",
|
16
|
+
"plugins": [
|
17
|
+
{"name": "esdoc-es7-plugin"},
|
18
|
+
{"name": "esdoc-plugin-async-to-sync"}
|
19
|
+
],
|
20
|
+
"test": {
|
21
|
+
"type": "mocha",
|
22
|
+
"source": "./test",
|
23
|
+
"includes": ["\\.(js|es6)$"]
|
24
|
+
},
|
25
|
+
"lint": true
|
26
|
+
}
|