@effectionx/process 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +269 -0
- package/dist/mod.d.ts +3 -0
- package/dist/mod.d.ts.map +1 -0
- package/{esm → dist}/src/daemon.d.ts +1 -1
- package/dist/src/daemon.d.ts.map +1 -0
- package/{script → dist}/src/exec/api.d.ts +2 -4
- package/dist/src/exec/api.d.ts.map +1 -0
- package/{script → dist}/src/exec/error.d.ts +1 -1
- package/dist/src/exec/error.d.ts.map +1 -0
- package/dist/src/exec/error.js +29 -0
- package/dist/src/exec/posix.d.ts +3 -0
- package/dist/src/exec/posix.d.ts.map +1 -0
- package/{esm → dist}/src/exec/posix.js +12 -13
- package/{esm → dist}/src/exec/win32.d.ts +1 -1
- package/dist/src/exec/win32.d.ts.map +1 -0
- package/{esm → dist}/src/exec/win32.js +20 -13
- package/{script → dist}/src/exec.d.ts +3 -3
- package/dist/src/exec.d.ts.map +1 -0
- package/{esm → dist}/src/exec.js +3 -5
- package/dist/src/helpers.d.ts +4 -0
- package/dist/src/helpers.d.ts.map +1 -0
- package/dist/src/helpers.js +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/mod.ts +2 -0
- package/package.json +25 -19
- package/src/daemon.ts +34 -0
- package/src/exec/api.ts +83 -0
- package/src/exec/error.ts +43 -0
- package/src/exec/posix.ts +133 -0
- package/src/exec/win32.ts +217 -0
- package/src/exec.ts +100 -0
- package/src/helpers.ts +12 -0
- package/test/daemon.test.ts +106 -0
- package/test/eventemitter.test.ts +82 -0
- package/test/exec.test.ts +481 -0
- package/test/fixtures/dump-args.js +13 -0
- package/test/fixtures/echo-server.ts +49 -0
- package/test/fixtures/hello-world-failed.js +5 -0
- package/test/fixtures/hello-world.js +5 -0
- package/test/helpers.ts +69 -0
- package/test/output-stream.test.ts +73 -0
- package/tsconfig.json +20 -0
- package/esm/mod.d.ts +0 -3
- package/esm/mod.d.ts.map +0 -1
- package/esm/package.json +0 -3
- package/esm/src/daemon.d.ts.map +0 -1
- package/esm/src/eventemitter.d.ts +0 -22
- package/esm/src/eventemitter.d.ts.map +0 -1
- package/esm/src/eventemitter.js +0 -40
- package/esm/src/exec/api.d.ts +0 -70
- package/esm/src/exec/api.d.ts.map +0 -1
- package/esm/src/exec/error.d.ts +0 -14
- package/esm/src/exec/error.d.ts.map +0 -1
- package/esm/src/exec/error.js +0 -54
- package/esm/src/exec/posix.d.ts +0 -3
- package/esm/src/exec/posix.d.ts.map +0 -1
- package/esm/src/exec/win32.d.ts.map +0 -1
- package/esm/src/exec.d.ts +0 -16
- package/esm/src/exec.d.ts.map +0 -1
- package/esm/src/helpers.d.ts +0 -12
- package/esm/src/helpers.d.ts.map +0 -1
- package/esm/src/helpers.js +0 -71
- package/script/mod.d.ts +0 -3
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -20
- package/script/package.json +0 -3
- package/script/src/daemon.d.ts +0 -11
- package/script/src/daemon.d.ts.map +0 -1
- package/script/src/daemon.js +0 -23
- package/script/src/eventemitter.d.ts +0 -22
- package/script/src/eventemitter.d.ts.map +0 -1
- package/script/src/eventemitter.js +0 -44
- package/script/src/exec/api.d.ts.map +0 -1
- package/script/src/exec/api.js +0 -2
- package/script/src/exec/error.d.ts.map +0 -1
- package/script/src/exec/error.js +0 -59
- package/script/src/exec/posix.d.ts +0 -3
- package/script/src/exec/posix.d.ts.map +0 -1
- package/script/src/exec/posix.js +0 -117
- package/script/src/exec/win32.d.ts +0 -4
- package/script/src/exec/win32.d.ts.map +0 -1
- package/script/src/exec/win32.js +0 -177
- package/script/src/exec.d.ts.map +0 -1
- package/script/src/exec.js +0 -92
- package/script/src/helpers.d.ts +0 -12
- package/script/src/helpers.d.ts.map +0 -1
- package/script/src/helpers.js +0 -76
- /package/{esm → dist}/mod.js +0 -0
- /package/{esm → dist}/src/daemon.js +0 -0
- /package/{esm → dist}/src/exec/api.js +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# @effection/process
|
|
2
|
+
|
|
3
|
+
## \[2.1.4]
|
|
4
|
+
|
|
5
|
+
### Dependencies
|
|
6
|
+
|
|
7
|
+
- Upgraded to `effection@2.0.8`
|
|
8
|
+
|
|
9
|
+
## \[2.1.3]
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated to latest `@effection/core`
|
|
14
|
+
- Updated to latest `effection`
|
|
15
|
+
|
|
16
|
+
## \[2.1.2]
|
|
17
|
+
|
|
18
|
+
- delegate `error` and `name` properties to underlying `Error`. fixes
|
|
19
|
+
https://github.com/thefrontside/effection/issues/675)
|
|
20
|
+
- Bumped due to a bump in effection.
|
|
21
|
+
- [84a66d7](https://github.com/thefrontside/effection/commit/84a66d799060ba2292fff2482d87bf6abafa7937)
|
|
22
|
+
Delegate error properties to original error on 2022-10-05
|
|
23
|
+
|
|
24
|
+
## \[2.1.1]
|
|
25
|
+
|
|
26
|
+
- Bump the `ctrlc-windows` package to include the new build process and remove
|
|
27
|
+
all dependencies.
|
|
28
|
+
- [4b7ca17](https://github.com/thefrontside/effection/commit/4b7ca1791a776bd1a7e4b8d100554aa683ebc49f)
|
|
29
|
+
bump ctrlc-windows to 2.1.0 on 2022-09-21
|
|
30
|
+
|
|
31
|
+
## \[2.1.0]
|
|
32
|
+
|
|
33
|
+
- The shell option now accepts a string which allows one to specify an exact
|
|
34
|
+
shell to run a command. This is helpful on windows as the default generally
|
|
35
|
+
doesn't handle bash-like syntax.
|
|
36
|
+
- [31d8512](https://github.com/thefrontside/effection/commit/31d85123535903820c7ee2c58891ad4f7ae385e5)
|
|
37
|
+
change file on 2022-03-29
|
|
38
|
+
|
|
39
|
+
## \[2.0.4]
|
|
40
|
+
|
|
41
|
+
- Allow pass object with `Symbol.operation` as an operation
|
|
42
|
+
- Bumped due to a bump in effection.
|
|
43
|
+
- [3e7daa8](https://github.com/thefrontside/effection/commit/3e7daa82cce974ea6b4ff90764343594ae7cba13)
|
|
44
|
+
add changelog on 2022-01-26
|
|
45
|
+
- [c623a84](https://github.com/thefrontside/effection/commit/c623a8448dfef764a03b3af6a6b0afa9ee834ba9)
|
|
46
|
+
remove fetch and process packages from changes list on 2022-01-26
|
|
47
|
+
|
|
48
|
+
## \[2.0.3]
|
|
49
|
+
|
|
50
|
+
- Remove redundant node-fetch from dependencies
|
|
51
|
+
- Bumped due to a bump in effection.
|
|
52
|
+
- [b4a87d5](https://github.com/thefrontside/effection/commit/b4a87d525d270e53b92543676c9fb10c7fd1edd7)
|
|
53
|
+
Add change file for covector on 2022-01-24
|
|
54
|
+
|
|
55
|
+
## \[2.0.2]
|
|
56
|
+
|
|
57
|
+
- Extract `AbortSignal` from `@effection/fetch` to `@effection/core` as a
|
|
58
|
+
resource
|
|
59
|
+
- Bumped due to a bump in effection.
|
|
60
|
+
- [8ac2e85](https://github.com/thefrontside/effection/commit/8ac2e8515ac2cb1ee6ed5a200f31d28024bfdae2)
|
|
61
|
+
Add covector change file on 2021-11-18
|
|
62
|
+
- [b6d0e15](https://github.com/thefrontside/effection/commit/b6d0e1502ca8345bf488aef695b16fe7a5a5945d)
|
|
63
|
+
Patch for fetch and not minor on 2021-11-19
|
|
64
|
+
|
|
65
|
+
## \[2.0.1]
|
|
66
|
+
|
|
67
|
+
- workaround borked 2.0 release https://status.npmjs.org/incidents/wy4002vc8ryc
|
|
68
|
+
- Bumped due to a bump in effection.
|
|
69
|
+
- [97711a7](https://github.com/thefrontside/effection/commit/97711a77419c8e539bff3060a9f3c1bae947f9b8)
|
|
70
|
+
Work around borked NPM release on 2021-10-12
|
|
71
|
+
|
|
72
|
+
## \[2.0.0]
|
|
73
|
+
|
|
74
|
+
- Release Effection 2.0.0
|
|
75
|
+
- [8bd89ad](https://github.com/thefrontside/effection/commit/8bd89ad40e42805ab6da0fd1b7a49beed9769865)
|
|
76
|
+
Add 2.0 changeset on %as
|
|
77
|
+
|
|
78
|
+
## \[2.0.0-beta.21]
|
|
79
|
+
|
|
80
|
+
- Yielding to something which is not an operation no longer throws an internal
|
|
81
|
+
error, but properly rejects the task.
|
|
82
|
+
- Bumped due to a bump in @effection/core.
|
|
83
|
+
- [a3ad19a](https://github.com/thefrontside/effection/commit/a3ad19a3177a731fee5cd2389ab898dee7b1788e)
|
|
84
|
+
Fix yielding non operation bug on 2021-10-07
|
|
85
|
+
|
|
86
|
+
## \[2.0.0-beta.20]
|
|
87
|
+
|
|
88
|
+
- Fix a bug when using blockParent where the children are not getting halt on an
|
|
89
|
+
explicit halt.
|
|
90
|
+
- Bumped due to a bump in @effection/core.
|
|
91
|
+
- [1cd9803](https://github.com/thefrontside/effection/commit/1cd98033d2641989114f9589c7d887954fa66781)
|
|
92
|
+
Fix halting children for blockParent tasks on 2021-09-30
|
|
93
|
+
|
|
94
|
+
## \[2.0.0-beta.19]
|
|
95
|
+
|
|
96
|
+
- Add Stream `toBuffer` and Stream `buffered` so we have both options on either
|
|
97
|
+
accessing the buffer directly or returning the stream.
|
|
98
|
+
- Bumped due to a bump in @effection/stream.
|
|
99
|
+
- [fe60532](https://github.com/thefrontside/effection/commit/fe60532c3f8cfdd8b53c324b7ea8e38e437f080f)
|
|
100
|
+
Add both toBuffer and buffered to Stream on 2021-09-30
|
|
101
|
+
|
|
102
|
+
## \[2.0.0-beta.18]
|
|
103
|
+
|
|
104
|
+
- Stream `buffer` returns the actual buffer and gives direct access to it
|
|
105
|
+
- Bumped due to a bump in @effection/stream.
|
|
106
|
+
- [07c8f83](https://github.com/thefrontside/effection/commit/07c8f83b5968f347ca72795c447be411e66274ed)
|
|
107
|
+
Stream `buffer` returns the actual buffer on 2021-09-30
|
|
108
|
+
|
|
109
|
+
## \[2.0.0-beta.17]
|
|
110
|
+
|
|
111
|
+
-
|
|
112
|
+
- [0248d79](https://github.com/thefrontside/effection/commit/0248d79a33dcfc4200b0832aba975c9cad08981e)
|
|
113
|
+
Add package readmes on 2021-09-28
|
|
114
|
+
- The `stdout` and `stderr` properties now return `OutputStream` instead of
|
|
115
|
+
regular `Stream`. Addiotionally, the `buffered` option has been removed.
|
|
116
|
+
- [4e9cb50](https://github.com/thefrontside/effection/commit/4e9cb5006249a208c62f7de30c1fd16a713725c7)
|
|
117
|
+
Improve process streams on 2021-09-22
|
|
118
|
+
- Split off `Stream` from subscription package into its own `@effection/stream`
|
|
119
|
+
package
|
|
120
|
+
- [248de1d](https://github.com/thefrontside/effection/commit/248de1dd31d172762d9601a2b5acd983dce61ab0)
|
|
121
|
+
Split `Stream` into its own package on 2021-09-27
|
|
122
|
+
|
|
123
|
+
## \[2.0.0-beta.16]
|
|
124
|
+
|
|
125
|
+
- Adjust the propagation of errors for resources to make it possible to catch
|
|
126
|
+
errors from `init`
|
|
127
|
+
- Bumped due to a bump in @effection/core.
|
|
128
|
+
- [75a7248](https://github.com/thefrontside/effection/commit/75a7248ae13d1126bbcaf9b6223f348168e987d0)
|
|
129
|
+
Catch errors thrown during resource init on 2021-09-21
|
|
130
|
+
- Enable support for resources in higher order operations `all`, `race` and
|
|
131
|
+
`withTimeout`.
|
|
132
|
+
- Bumped due to a bump in @effection/core.
|
|
133
|
+
- [bbe6cdc](https://github.com/thefrontside/effection/commit/bbe6cdc44184a7669278d0d01ad23a2a79a69e52)
|
|
134
|
+
Enable resource support for higher order operations on 2021-09-09
|
|
135
|
+
|
|
136
|
+
## \[2.0.0-beta.15]
|
|
137
|
+
|
|
138
|
+
- Add shortcuts to create resolved/rejected/halted futures via
|
|
139
|
+
Future.resolve(123), etc...
|
|
140
|
+
- Bumped due to a bump in @effection/core.
|
|
141
|
+
- [9599dde](https://github.com/thefrontside/effection/commit/9599dde14e9bc3ba4ac7ea473e8624164727be0c)
|
|
142
|
+
Add shortcuts for resolves/rejected/halted future on 2021-09-08
|
|
143
|
+
|
|
144
|
+
## \[2.0.0-beta.14]
|
|
145
|
+
|
|
146
|
+
- Improve naming scheme for process labels
|
|
147
|
+
- [82f31cd](https://github.com/thefrontside/effection/commit/82f31cd3fc8c490a795ee83ad61fd38fef18e8ea)
|
|
148
|
+
Improve naming scheme of exec labels on 2021-09-06
|
|
149
|
+
- Apply labels to the operations. These will improve error output and show up in
|
|
150
|
+
the effection inspector.
|
|
151
|
+
- [74160a5](https://github.com/thefrontside/effection/commit/74160a51f9c937e8fd6c1690eba7494a51c88d8c)
|
|
152
|
+
label @effection/process Operations on 2021-07-20
|
|
153
|
+
|
|
154
|
+
## \[2.0.0-beta.13]
|
|
155
|
+
|
|
156
|
+
- Allow channels to be named so their internal stream gets named
|
|
157
|
+
- Bumped due to a bump in @effection/channel.
|
|
158
|
+
- [c52018a](https://github.com/thefrontside/effection/commit/c52018a1035d551cef76a757d1dc29781b59c851)
|
|
159
|
+
Allow channels to be named on 2021-08-27
|
|
160
|
+
|
|
161
|
+
## \[2.0.0-beta.12]
|
|
162
|
+
|
|
163
|
+
- Update core dependency
|
|
164
|
+
- Bumped due to a bump in @effection/mocha.
|
|
165
|
+
- [d92eee5](https://github.com/thefrontside/effection/commit/d92eee594fdb8dc6d8ab6a37b6aa362122e63f6e)
|
|
166
|
+
Update core dependency on 2021-08-16
|
|
167
|
+
|
|
168
|
+
## \[2.0.0-beta.11]
|
|
169
|
+
|
|
170
|
+
- Use Object.create to wrap error objects rather than copying properties
|
|
171
|
+
- Bumped due to a bump in @effection/core.
|
|
172
|
+
- [a56ae2a](https://github.com/thefrontside/effection/commit/a56ae2af8a6247697b8b6253bd35b6d9e569613d)
|
|
173
|
+
Use Object.create to create error object with trace on 2021-08-16
|
|
174
|
+
|
|
175
|
+
## \[2.0.0-beta.10]
|
|
176
|
+
|
|
177
|
+
- add `Task#spawn` operation to spawn new task with a specific scope
|
|
178
|
+
- Bumped due to a bump in @effection/core.
|
|
179
|
+
- [a71d65b](https://github.com/thefrontside/effection/commit/a71d65b77df5c337a78b7934edd181080eacf5bf)
|
|
180
|
+
Add changefile on 2021-07-27
|
|
181
|
+
|
|
182
|
+
## \[2.0.0-beta.9]
|
|
183
|
+
|
|
184
|
+
- Add sideEffects field to package.json
|
|
185
|
+
- [383141d](https://github.com/thefrontside/effection/commit/383141dc556c6a781d98087f3b68085d5eb31173)
|
|
186
|
+
Add sideEffects field to package.json
|
|
187
|
+
([#470](https://github.com/thefrontside/effection/pull/470)) on 2021-08-05
|
|
188
|
+
|
|
189
|
+
## \[2.0.0-beta.8]
|
|
190
|
+
|
|
191
|
+
- The `dist` directory didn't contain the `esm` and `cjs` directory. We copy the
|
|
192
|
+
`package.json` for reference into the dist, and this broke the `files`
|
|
193
|
+
resolution. Switch to using `dist-cjs` and `dist-esm` which allows us to avoid
|
|
194
|
+
copying `package.json`.
|
|
195
|
+
- [63fbcfb](https://github.com/thefrontside/effection/commit/63fbcfb8151bb7434f1cb8c58bfed25012ad2727)
|
|
196
|
+
fix: @effection/core to ship dist/esm and dist/cjs on 2021-08-03
|
|
197
|
+
- [7788e24](https://github.com/thefrontside/effection/commit/7788e2408bcff8180b24ce497043283c97b6dbaa)
|
|
198
|
+
fix: @effection/core to ship dist-esm and dist-cjs on 2021-08-03
|
|
199
|
+
- [6923a0f](https://github.com/thefrontside/effection/commit/6923a0fa1a84cd0788f8c9c1600ccf7539b08bbf)
|
|
200
|
+
update change file with everything patched on 2021-08-03
|
|
201
|
+
|
|
202
|
+
## \[2.0.0-beta.7]
|
|
203
|
+
|
|
204
|
+
- Add esm builds
|
|
205
|
+
- Bumped due to a bump in @effection/core.
|
|
206
|
+
- [6660a46](https://github.com/thefrontside/effection/commit/6660a466a50c9b9c36829c2d52448ebbc0e7e6fb)
|
|
207
|
+
Add esm build ([#462](https://github.com/thefrontside/effection/pull/462))
|
|
208
|
+
on 2021-08-03
|
|
209
|
+
|
|
210
|
+
## \[2.0.0-beta.6]
|
|
211
|
+
|
|
212
|
+
- remove accidentally compiled .js files from distributed sources
|
|
213
|
+
- Bumped due to a bump in @effection/mocha.
|
|
214
|
+
- [f0f0023](https://github.com/thefrontside/effection/commit/f0f002354743ae6d6f69bfe6df28ddc11d0f8be0)
|
|
215
|
+
add changefile on 2021-07-26
|
|
216
|
+
|
|
217
|
+
## \[2.0.0-beta.5]
|
|
218
|
+
|
|
219
|
+
- Upgrade typescript to 4.3.5 and replace tsdx with tsc
|
|
220
|
+
- [121bd40](https://github.com/thefrontside/effection/commit/121bd40e17609a82bce649c5fed34ee0754681b7)
|
|
221
|
+
Add change file for typescript bump on 2021-07-23
|
|
222
|
+
|
|
223
|
+
## 2.0.0-beta.4
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- Updated dependencies \[e297c86]
|
|
228
|
+
- @effection/core@2.0.0-beta.4
|
|
229
|
+
- @effection/channel@2.0.0-beta.4
|
|
230
|
+
- @effection/events@2.0.0-beta.4
|
|
231
|
+
- @effection/subscription@2.0.0-beta.4
|
|
232
|
+
|
|
233
|
+
## 2.0.0-beta.3
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- Updated dependencies \[3e77f29]
|
|
238
|
+
- Updated dependencies \[5d95e6d]
|
|
239
|
+
- Updated dependencies \[9700b45]
|
|
240
|
+
- Updated dependencies \[9700b45]
|
|
241
|
+
- @effection/subscription@2.0.0-beta.3
|
|
242
|
+
- @effection/events@2.0.0-beta.3
|
|
243
|
+
- @effection/core@2.0.0-beta.3
|
|
244
|
+
- @effection/channel@2.0.0-beta.3
|
|
245
|
+
|
|
246
|
+
## 2.0.0-beta.2
|
|
247
|
+
|
|
248
|
+
### Patch Changes
|
|
249
|
+
|
|
250
|
+
- Updated dependencies \[19414f0]
|
|
251
|
+
- Updated dependencies \[26a86cb]
|
|
252
|
+
- Updated dependencies \[9c76cc5]
|
|
253
|
+
- Updated dependencies \[f7e3344]
|
|
254
|
+
- Updated dependencies \[ac7c1ce]
|
|
255
|
+
- @effection/core@2.0.0-beta.2
|
|
256
|
+
- @effection/channel@2.0.0-beta.2
|
|
257
|
+
- @effection/events@2.0.0-beta.2
|
|
258
|
+
- @effection/subscription@2.0.0-beta.2
|
|
259
|
+
|
|
260
|
+
## 2.0.0-beta.1
|
|
261
|
+
|
|
262
|
+
### Patch Changes
|
|
263
|
+
|
|
264
|
+
- 0c6e263: release 2.0.0-beta
|
|
265
|
+
- Updated dependencies \[0c6e263]
|
|
266
|
+
- @effection/channel@2.0.0-beta.1
|
|
267
|
+
- @effection/core@2.0.0-beta.1
|
|
268
|
+
- @effection/events@2.0.0-beta.1
|
|
269
|
+
- @effection/subscription@2.0.0-beta.1
|
package/dist/mod.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../src/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,WAAW,CAAC;AAErD,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,OAAO,EACb,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,MAAO,SAAQ,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO;CAAG;AAE3D;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,WAAgB,GACxB,SAAS,CAAC,MAAM,CAAC,CAanB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Operation } from "effection";
|
|
2
|
-
import type { OutputStream } from "../helpers.
|
|
2
|
+
import type { OutputStream } from "../helpers.ts";
|
|
3
3
|
export interface Writable<T> {
|
|
4
4
|
send(message: T): void;
|
|
5
5
|
}
|
|
@@ -64,7 +64,5 @@ export interface ProcessResult extends ExitStatus {
|
|
|
64
64
|
stdout: string;
|
|
65
65
|
stderr: string;
|
|
66
66
|
}
|
|
67
|
-
export
|
|
68
|
-
(command: string, options: ExecOptions): Operation<Process>;
|
|
69
|
-
}
|
|
67
|
+
export type CreateOSProcess = (command: string, options: ExecOptions) => Operation<Process>;
|
|
70
68
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/exec/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAQ,SAAQ,KAAK;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,IAAI,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IAE9B;;;OAGG;IACH,MAAM,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,KACjB,SAAS,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/exec/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExD,qBAAa,SAAU,SAAQ,KAAK;IAClC,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;gBAET,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAO5D,IAAI,SAAe;IAE5B,IAAa,OAAO,IAAI,MAAM,CAiB7B;CACF;AAED,qBAAa,eAAgB,SAAQ,SAAS;IACnC,IAAI,SAAqB;IAElC,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class ExecError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
command;
|
|
4
|
+
options;
|
|
5
|
+
constructor(status, command, options) {
|
|
6
|
+
super();
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.command = command;
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
name = "ExecError";
|
|
12
|
+
get message() {
|
|
13
|
+
let code = this.status.code ? `code: ${this.status.code}` : null;
|
|
14
|
+
let signal = this.status.signal ? `signal: ${this.status.signal}` : null;
|
|
15
|
+
let env = `env: ${JSON.stringify(this.options.env || {})}`;
|
|
16
|
+
let shell = this.options.shell ? `shell: ${this.options.shell}` : null;
|
|
17
|
+
let cwd = this.options.cwd ? `cwd: ${this.options.cwd}` : null;
|
|
18
|
+
let command = `$ ${this.command} ${this.options.arguments?.join(" ")}`.trim();
|
|
19
|
+
return [code, signal, env, shell, cwd, command]
|
|
20
|
+
.filter((item) => !!item)
|
|
21
|
+
.join("\n");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class DaemonExitError extends ExecError {
|
|
25
|
+
name = "DaemonExitError";
|
|
26
|
+
get message() {
|
|
27
|
+
return `daemon process quit unexpectedly\n${super.message}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../../src/exec/posix.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,UAAU,CAAC;AAKtE,eAAO,MAAM,kBAAkB,EAAE,eAiHhC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn as spawnProcess } from "node:child_process";
|
|
2
|
-
import { all, createSignal, Err, Ok, resource, spawn, withResolvers, } from "effection";
|
|
3
2
|
import process from "node:process";
|
|
4
|
-
import { once } from "
|
|
5
|
-
import {
|
|
3
|
+
import { once } from "@effectionx/node/events";
|
|
4
|
+
import { fromReadable } from "@effectionx/node/stream";
|
|
5
|
+
import { Err, Ok, all, createSignal, resource, spawn, withResolvers, } from "effection";
|
|
6
6
|
import { ExecError } from "./error.js";
|
|
7
7
|
export const createPosixProcess = (command, options) => {
|
|
8
8
|
return resource(function* (provide) {
|
|
@@ -25,9 +25,12 @@ export const createPosixProcess = (command, options) => {
|
|
|
25
25
|
stdio: "pipe",
|
|
26
26
|
});
|
|
27
27
|
let { pid } = childProcess;
|
|
28
|
+
if (!childProcess.stdout || !childProcess.stderr) {
|
|
29
|
+
throw new Error("stdout and stderr must be available with stdio: pipe");
|
|
30
|
+
}
|
|
28
31
|
let io = {
|
|
29
|
-
stdout: yield*
|
|
30
|
-
stderr: yield*
|
|
32
|
+
stdout: yield* fromReadable(childProcess.stdout),
|
|
33
|
+
stderr: yield* fromReadable(childProcess.stderr),
|
|
31
34
|
stdoutDone: withResolvers(),
|
|
32
35
|
stderrDone: withResolvers(),
|
|
33
36
|
};
|
|
@@ -70,18 +73,14 @@ export const createPosixProcess = (command, options) => {
|
|
|
70
73
|
let [code, signal] = result.value;
|
|
71
74
|
return { command, options, code, signal };
|
|
72
75
|
}
|
|
73
|
-
|
|
74
|
-
throw result.error;
|
|
75
|
-
}
|
|
76
|
+
throw result.error;
|
|
76
77
|
}
|
|
77
78
|
function* expect() {
|
|
78
79
|
let status = yield* join();
|
|
79
|
-
if (status.code
|
|
80
|
+
if (status.code !== 0) {
|
|
80
81
|
throw new ExecError(status, command, options);
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
return status;
|
|
84
|
-
}
|
|
83
|
+
return status;
|
|
85
84
|
}
|
|
86
85
|
try {
|
|
87
86
|
yield* provide({
|
|
@@ -96,7 +95,7 @@ export const createPosixProcess = (command, options) => {
|
|
|
96
95
|
finally {
|
|
97
96
|
try {
|
|
98
97
|
if (typeof childProcess.pid === "undefined") {
|
|
99
|
-
//
|
|
98
|
+
// biome-ignore lint/correctness/noUnsafeFinally: Intentional error for missing PID
|
|
100
99
|
throw new Error("no pid for childProcess");
|
|
101
100
|
}
|
|
102
101
|
process.kill(-childProcess.pid, "SIGTERM");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"win32.d.ts","sourceRoot":"","sources":["../../../src/exec/win32.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,UAAU,CAAC;AAkBtE,eAAO,MAAM,kBAAkB,EAAE,eAoLhC,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,OAAiC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { platform } from "node:os";
|
|
2
|
-
import {
|
|
2
|
+
import { once } from "@effectionx/node/events";
|
|
3
|
+
import { fromReadable } from "@effectionx/node/stream";
|
|
3
4
|
// @ts-types="npm:@types/cross-spawn@6.0.6"
|
|
4
5
|
import { spawn as spawnProcess } from "cross-spawn";
|
|
5
6
|
import { ctrlc } from "ctrlc-windows";
|
|
6
|
-
import {
|
|
7
|
-
import { useReadable } from "../helpers.js";
|
|
7
|
+
import { Err, Ok, all, createSignal, resource, spawn, withResolvers, } from "effection";
|
|
8
8
|
import { ExecError } from "./error.js";
|
|
9
9
|
function* killTree(pid) {
|
|
10
10
|
try {
|
|
@@ -39,9 +39,12 @@ export const createWin32Process = (command, options) => {
|
|
|
39
39
|
cwd: options.cwd,
|
|
40
40
|
});
|
|
41
41
|
let { pid } = childProcess;
|
|
42
|
+
if (!childProcess.stdout || !childProcess.stderr) {
|
|
43
|
+
throw new Error("stdout and stderr must be available with stdio: pipe");
|
|
44
|
+
}
|
|
42
45
|
let io = {
|
|
43
|
-
stdout: yield*
|
|
44
|
-
stderr: yield*
|
|
46
|
+
stdout: yield* fromReadable(childProcess.stdout),
|
|
47
|
+
stderr: yield* fromReadable(childProcess.stderr),
|
|
45
48
|
stdoutDone: withResolvers(),
|
|
46
49
|
stderrDone: withResolvers(),
|
|
47
50
|
};
|
|
@@ -85,19 +88,23 @@ export const createWin32Process = (command, options) => {
|
|
|
85
88
|
let [code, signal] = result.value;
|
|
86
89
|
return { command, options, code, signal };
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
throw result.error;
|
|
90
|
-
}
|
|
91
|
+
throw result.error;
|
|
91
92
|
}
|
|
92
93
|
function* expect() {
|
|
93
94
|
let status = yield* join();
|
|
94
|
-
if (status.code
|
|
95
|
+
if (status.code !== 0) {
|
|
95
96
|
throw new ExecError(status, command, options);
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
return status;
|
|
99
|
-
}
|
|
98
|
+
return status;
|
|
100
99
|
}
|
|
100
|
+
// Suppress EPIPE errors on stdin - these occur on Windows when the child
|
|
101
|
+
// process exits before we finish writing to it. This is expected during
|
|
102
|
+
// cleanup when we're killing the process.
|
|
103
|
+
childProcess.stdin.on("error", (err) => {
|
|
104
|
+
if (err.code !== "EPIPE") {
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
101
108
|
try {
|
|
102
109
|
yield* provide({
|
|
103
110
|
pid: pid,
|
|
@@ -114,7 +121,7 @@ export const createWin32Process = (command, options) => {
|
|
|
114
121
|
if (childProcess.exitCode === null &&
|
|
115
122
|
childProcess.signalCode === null) {
|
|
116
123
|
if (typeof childProcess.pid === "undefined") {
|
|
117
|
-
//
|
|
124
|
+
// biome-ignore lint/correctness/noUnsafeFinally: Intentional error for missing PID
|
|
118
125
|
throw new Error("no pid for childProcess");
|
|
119
126
|
}
|
|
120
127
|
let stdinStream = childProcess.stdin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Operation } from "effection";
|
|
2
|
-
import type { ExecOptions, Process, ProcessResult } from "./exec/api.
|
|
3
|
-
export * from "./exec/api.
|
|
4
|
-
export * from "./exec/error.
|
|
2
|
+
import type { ExecOptions, Process, ProcessResult } from "./exec/api.ts";
|
|
3
|
+
export * from "./exec/api.ts";
|
|
4
|
+
export * from "./exec/error.ts";
|
|
5
5
|
export interface Exec extends Operation<Process> {
|
|
6
6
|
join(): Operation<ProcessResult>;
|
|
7
7
|
expect(): Operation<ProcessResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/exec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAEV,WAAW,EAEX,OAAO,EACP,aAAa,EACd,MAAM,eAAe,CAAC;AAIvB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAEhC,MAAM,WAAW,IAAK,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC9C,IAAI,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;IACjC,MAAM,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;CACpC;AASD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAiErE"}
|
package/{esm → dist}/src/exec.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import shellwords from "shellwords-ts";
|
|
2
2
|
import { spawn } from "effection";
|
|
3
3
|
import { createPosixProcess } from "./exec/posix.js";
|
|
4
4
|
import { createWin32Process, isWin32 } from "./exec/win32.js";
|
|
@@ -8,9 +8,7 @@ const createProcess = (cmd, opts) => {
|
|
|
8
8
|
if (isWin32()) {
|
|
9
9
|
return createWin32Process(cmd, opts);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
return createPosixProcess(cmd, opts);
|
|
13
|
-
}
|
|
11
|
+
return createPosixProcess(cmd, opts);
|
|
14
12
|
};
|
|
15
13
|
/**
|
|
16
14
|
* Execute `command` with `options`. You should use this operation for processes
|
|
@@ -19,7 +17,7 @@ const createProcess = (cmd, opts) => {
|
|
|
19
17
|
* forever, consider using `daemon()`
|
|
20
18
|
*/
|
|
21
19
|
export function exec(command, options = {}) {
|
|
22
|
-
let [cmd, ...args] = options.shell ? [command] : split(command);
|
|
20
|
+
let [cmd, ...args] = options.shell ? [command] : shellwords.split(command);
|
|
23
21
|
let opts = { ...options, arguments: args.concat(options.arguments || []) };
|
|
24
22
|
return {
|
|
25
23
|
*[Symbol.iterator]() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAEpD,wBAAiB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAOpE"}
|