@anthropic-ai/claude-code 0.2.29 → 0.2.30

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.
Files changed (415) hide show
  1. package/cli.mjs +442 -690
  2. package/package.json +1 -5
  3. package/vendor/sdk/CHANGELOG.md +0 -1421
  4. package/vendor/sdk/LICENSE +0 -8
  5. package/vendor/sdk/README.md +0 -536
  6. package/vendor/sdk/_shims/MultipartBody.d.ts +0 -9
  7. package/vendor/sdk/_shims/MultipartBody.d.ts.map +0 -1
  8. package/vendor/sdk/_shims/MultipartBody.js +0 -16
  9. package/vendor/sdk/_shims/MultipartBody.js.map +0 -1
  10. package/vendor/sdk/_shims/MultipartBody.mjs +0 -12
  11. package/vendor/sdk/_shims/MultipartBody.mjs.map +0 -1
  12. package/vendor/sdk/_shims/README.md +0 -46
  13. package/vendor/sdk/_shims/auto/runtime-bun.d.ts +0 -5
  14. package/vendor/sdk/_shims/auto/runtime-bun.d.ts.map +0 -1
  15. package/vendor/sdk/_shims/auto/runtime-bun.js +0 -21
  16. package/vendor/sdk/_shims/auto/runtime-bun.js.map +0 -1
  17. package/vendor/sdk/_shims/auto/runtime-bun.mjs +0 -2
  18. package/vendor/sdk/_shims/auto/runtime-bun.mjs.map +0 -1
  19. package/vendor/sdk/_shims/auto/runtime-node.d.ts +0 -5
  20. package/vendor/sdk/_shims/auto/runtime-node.d.ts.map +0 -1
  21. package/vendor/sdk/_shims/auto/runtime-node.js +0 -21
  22. package/vendor/sdk/_shims/auto/runtime-node.js.map +0 -1
  23. package/vendor/sdk/_shims/auto/runtime-node.mjs +0 -2
  24. package/vendor/sdk/_shims/auto/runtime-node.mjs.map +0 -1
  25. package/vendor/sdk/_shims/auto/runtime.d.ts +0 -5
  26. package/vendor/sdk/_shims/auto/runtime.d.ts.map +0 -1
  27. package/vendor/sdk/_shims/auto/runtime.js +0 -21
  28. package/vendor/sdk/_shims/auto/runtime.js.map +0 -1
  29. package/vendor/sdk/_shims/auto/runtime.mjs +0 -2
  30. package/vendor/sdk/_shims/auto/runtime.mjs.map +0 -1
  31. package/vendor/sdk/_shims/auto/types-node.d.ts +0 -5
  32. package/vendor/sdk/_shims/auto/types-node.d.ts.map +0 -1
  33. package/vendor/sdk/_shims/auto/types-node.js +0 -21
  34. package/vendor/sdk/_shims/auto/types-node.js.map +0 -1
  35. package/vendor/sdk/_shims/auto/types-node.mjs +0 -2
  36. package/vendor/sdk/_shims/auto/types-node.mjs.map +0 -1
  37. package/vendor/sdk/_shims/auto/types.d.ts +0 -101
  38. package/vendor/sdk/_shims/auto/types.js +0 -3
  39. package/vendor/sdk/_shims/auto/types.mjs +0 -3
  40. package/vendor/sdk/_shims/bun-runtime.d.ts +0 -6
  41. package/vendor/sdk/_shims/bun-runtime.d.ts.map +0 -1
  42. package/vendor/sdk/_shims/bun-runtime.js +0 -14
  43. package/vendor/sdk/_shims/bun-runtime.js.map +0 -1
  44. package/vendor/sdk/_shims/bun-runtime.mjs +0 -10
  45. package/vendor/sdk/_shims/bun-runtime.mjs.map +0 -1
  46. package/vendor/sdk/_shims/index.d.ts +0 -81
  47. package/vendor/sdk/_shims/index.js +0 -13
  48. package/vendor/sdk/_shims/index.mjs +0 -7
  49. package/vendor/sdk/_shims/manual-types.d.ts +0 -12
  50. package/vendor/sdk/_shims/manual-types.js +0 -3
  51. package/vendor/sdk/_shims/manual-types.mjs +0 -3
  52. package/vendor/sdk/_shims/node-runtime.d.ts +0 -3
  53. package/vendor/sdk/_shims/node-runtime.d.ts.map +0 -1
  54. package/vendor/sdk/_shims/node-runtime.js +0 -89
  55. package/vendor/sdk/_shims/node-runtime.js.map +0 -1
  56. package/vendor/sdk/_shims/node-runtime.mjs +0 -56
  57. package/vendor/sdk/_shims/node-runtime.mjs.map +0 -1
  58. package/vendor/sdk/_shims/node-types.d.ts +0 -42
  59. package/vendor/sdk/_shims/node-types.js +0 -3
  60. package/vendor/sdk/_shims/node-types.mjs +0 -3
  61. package/vendor/sdk/_shims/registry.d.ts +0 -37
  62. package/vendor/sdk/_shims/registry.d.ts.map +0 -1
  63. package/vendor/sdk/_shims/registry.js +0 -41
  64. package/vendor/sdk/_shims/registry.js.map +0 -1
  65. package/vendor/sdk/_shims/registry.mjs +0 -37
  66. package/vendor/sdk/_shims/registry.mjs.map +0 -1
  67. package/vendor/sdk/_shims/web-runtime.d.ts +0 -5
  68. package/vendor/sdk/_shims/web-runtime.d.ts.map +0 -1
  69. package/vendor/sdk/_shims/web-runtime.js +0 -78
  70. package/vendor/sdk/_shims/web-runtime.js.map +0 -1
  71. package/vendor/sdk/_shims/web-runtime.mjs +0 -71
  72. package/vendor/sdk/_shims/web-runtime.mjs.map +0 -1
  73. package/vendor/sdk/_shims/web-types.d.ts +0 -83
  74. package/vendor/sdk/_shims/web-types.js +0 -3
  75. package/vendor/sdk/_shims/web-types.mjs +0 -3
  76. package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts +0 -3
  77. package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts.map +0 -1
  78. package/vendor/sdk/_vendor/partial-json-parser/parser.js +0 -226
  79. package/vendor/sdk/_vendor/partial-json-parser/parser.js.map +0 -1
  80. package/vendor/sdk/_vendor/partial-json-parser/parser.mjs +0 -223
  81. package/vendor/sdk/_vendor/partial-json-parser/parser.mjs.map +0 -1
  82. package/vendor/sdk/core.d.ts +0 -248
  83. package/vendor/sdk/core.d.ts.map +0 -1
  84. package/vendor/sdk/core.js +0 -935
  85. package/vendor/sdk/core.js.map +0 -1
  86. package/vendor/sdk/core.mjs +0 -903
  87. package/vendor/sdk/core.mjs.map +0 -1
  88. package/vendor/sdk/error.d.ts +0 -48
  89. package/vendor/sdk/error.d.ts.map +0 -1
  90. package/vendor/sdk/error.js +0 -114
  91. package/vendor/sdk/error.js.map +0 -1
  92. package/vendor/sdk/error.mjs +0 -98
  93. package/vendor/sdk/error.mjs.map +0 -1
  94. package/vendor/sdk/index.d.mts +0 -152
  95. package/vendor/sdk/index.d.ts +0 -152
  96. package/vendor/sdk/index.d.ts.map +0 -1
  97. package/vendor/sdk/index.js +0 -179
  98. package/vendor/sdk/index.js.map +0 -1
  99. package/vendor/sdk/index.mjs +0 -136
  100. package/vendor/sdk/index.mjs.map +0 -1
  101. package/vendor/sdk/internal/decoders/jsonl.d.ts +0 -12
  102. package/vendor/sdk/internal/decoders/jsonl.d.ts.map +0 -1
  103. package/vendor/sdk/internal/decoders/jsonl.js +0 -35
  104. package/vendor/sdk/internal/decoders/jsonl.js.map +0 -1
  105. package/vendor/sdk/internal/decoders/jsonl.mjs +0 -31
  106. package/vendor/sdk/internal/decoders/jsonl.mjs.map +0 -1
  107. package/vendor/sdk/internal/decoders/line.d.ts +0 -20
  108. package/vendor/sdk/internal/decoders/line.d.ts.map +0 -1
  109. package/vendor/sdk/internal/decoders/line.js +0 -123
  110. package/vendor/sdk/internal/decoders/line.js.map +0 -1
  111. package/vendor/sdk/internal/decoders/line.mjs +0 -119
  112. package/vendor/sdk/internal/decoders/line.mjs.map +0 -1
  113. package/vendor/sdk/internal/stream-utils.d.ts +0 -8
  114. package/vendor/sdk/internal/stream-utils.d.ts.map +0 -1
  115. package/vendor/sdk/internal/stream-utils.js +0 -39
  116. package/vendor/sdk/internal/stream-utils.js.map +0 -1
  117. package/vendor/sdk/internal/stream-utils.mjs +0 -35
  118. package/vendor/sdk/internal/stream-utils.mjs.map +0 -1
  119. package/vendor/sdk/lib/BetaMessageStream.d.ts +0 -114
  120. package/vendor/sdk/lib/BetaMessageStream.d.ts.map +0 -1
  121. package/vendor/sdk/lib/BetaMessageStream.js +0 -547
  122. package/vendor/sdk/lib/BetaMessageStream.js.map +0 -1
  123. package/vendor/sdk/lib/BetaMessageStream.mjs +0 -543
  124. package/vendor/sdk/lib/BetaMessageStream.mjs.map +0 -1
  125. package/vendor/sdk/lib/MessageStream.d.ts +0 -114
  126. package/vendor/sdk/lib/MessageStream.d.ts.map +0 -1
  127. package/vendor/sdk/lib/MessageStream.js +0 -547
  128. package/vendor/sdk/lib/MessageStream.js.map +0 -1
  129. package/vendor/sdk/lib/MessageStream.mjs +0 -543
  130. package/vendor/sdk/lib/MessageStream.mjs.map +0 -1
  131. package/vendor/sdk/node_modules/@types/node/LICENSE +0 -21
  132. package/vendor/sdk/node_modules/@types/node/README.md +0 -15
  133. package/vendor/sdk/node_modules/@types/node/assert/strict.d.ts +0 -8
  134. package/vendor/sdk/node_modules/@types/node/assert.d.ts +0 -985
  135. package/vendor/sdk/node_modules/@types/node/async_hooks.d.ts +0 -522
  136. package/vendor/sdk/node_modules/@types/node/buffer.buffer.d.ts +0 -385
  137. package/vendor/sdk/node_modules/@types/node/buffer.d.ts +0 -1903
  138. package/vendor/sdk/node_modules/@types/node/child_process.d.ts +0 -1549
  139. package/vendor/sdk/node_modules/@types/node/cluster.d.ts +0 -578
  140. package/vendor/sdk/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  141. package/vendor/sdk/node_modules/@types/node/compatibility/index.d.ts +0 -9
  142. package/vendor/sdk/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  143. package/vendor/sdk/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  144. package/vendor/sdk/node_modules/@types/node/console.d.ts +0 -452
  145. package/vendor/sdk/node_modules/@types/node/constants.d.ts +0 -19
  146. package/vendor/sdk/node_modules/@types/node/crypto.d.ts +0 -4453
  147. package/vendor/sdk/node_modules/@types/node/dgram.d.ts +0 -596
  148. package/vendor/sdk/node_modules/@types/node/diagnostics_channel.d.ts +0 -546
  149. package/vendor/sdk/node_modules/@types/node/dns/promises.d.ts +0 -475
  150. package/vendor/sdk/node_modules/@types/node/dns.d.ts +0 -853
  151. package/vendor/sdk/node_modules/@types/node/dom-events.d.ts +0 -124
  152. package/vendor/sdk/node_modules/@types/node/domain.d.ts +0 -170
  153. package/vendor/sdk/node_modules/@types/node/events.d.ts +0 -819
  154. package/vendor/sdk/node_modules/@types/node/fs/promises.d.ts +0 -1205
  155. package/vendor/sdk/node_modules/@types/node/fs.d.ts +0 -4237
  156. package/vendor/sdk/node_modules/@types/node/globals.d.ts +0 -442
  157. package/vendor/sdk/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  158. package/vendor/sdk/node_modules/@types/node/http.d.ts +0 -1839
  159. package/vendor/sdk/node_modules/@types/node/http2.d.ts +0 -2517
  160. package/vendor/sdk/node_modules/@types/node/https.d.ts +0 -544
  161. package/vendor/sdk/node_modules/@types/node/index.d.ts +0 -90
  162. package/vendor/sdk/node_modules/@types/node/inspector.d.ts +0 -2775
  163. package/vendor/sdk/node_modules/@types/node/module.d.ts +0 -291
  164. package/vendor/sdk/node_modules/@types/node/net.d.ts +0 -924
  165. package/vendor/sdk/node_modules/@types/node/os.d.ts +0 -473
  166. package/vendor/sdk/node_modules/@types/node/package.json +0 -225
  167. package/vendor/sdk/node_modules/@types/node/path.d.ts +0 -191
  168. package/vendor/sdk/node_modules/@types/node/perf_hooks.d.ts +0 -753
  169. package/vendor/sdk/node_modules/@types/node/process.d.ts +0 -1553
  170. package/vendor/sdk/node_modules/@types/node/punycode.d.ts +0 -117
  171. package/vendor/sdk/node_modules/@types/node/querystring.d.ts +0 -141
  172. package/vendor/sdk/node_modules/@types/node/readline/promises.d.ts +0 -154
  173. package/vendor/sdk/node_modules/@types/node/readline.d.ts +0 -715
  174. package/vendor/sdk/node_modules/@types/node/repl.d.ts +0 -430
  175. package/vendor/sdk/node_modules/@types/node/stream/consumers.d.ts +0 -12
  176. package/vendor/sdk/node_modules/@types/node/stream/promises.d.ts +0 -90
  177. package/vendor/sdk/node_modules/@types/node/stream/web.d.ts +0 -523
  178. package/vendor/sdk/node_modules/@types/node/stream.d.ts +0 -1731
  179. package/vendor/sdk/node_modules/@types/node/string_decoder.d.ts +0 -67
  180. package/vendor/sdk/node_modules/@types/node/test.d.ts +0 -1245
  181. package/vendor/sdk/node_modules/@types/node/timers/promises.d.ts +0 -93
  182. package/vendor/sdk/node_modules/@types/node/timers.d.ts +0 -126
  183. package/vendor/sdk/node_modules/@types/node/tls.d.ts +0 -1203
  184. package/vendor/sdk/node_modules/@types/node/trace_events.d.ts +0 -171
  185. package/vendor/sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -385
  186. package/vendor/sdk/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  187. package/vendor/sdk/node_modules/@types/node/ts5.6/index.d.ts +0 -90
  188. package/vendor/sdk/node_modules/@types/node/tty.d.ts +0 -206
  189. package/vendor/sdk/node_modules/@types/node/url.d.ts +0 -957
  190. package/vendor/sdk/node_modules/@types/node/util.d.ts +0 -2083
  191. package/vendor/sdk/node_modules/@types/node/v8.d.ts +0 -753
  192. package/vendor/sdk/node_modules/@types/node/vm.d.ts +0 -666
  193. package/vendor/sdk/node_modules/@types/node/wasi.d.ts +0 -160
  194. package/vendor/sdk/node_modules/@types/node/worker_threads.d.ts +0 -695
  195. package/vendor/sdk/node_modules/@types/node/zlib.d.ts +0 -517
  196. package/vendor/sdk/node_modules/undici-types/README.md +0 -6
  197. package/vendor/sdk/node_modules/undici-types/agent.d.ts +0 -31
  198. package/vendor/sdk/node_modules/undici-types/api.d.ts +0 -43
  199. package/vendor/sdk/node_modules/undici-types/balanced-pool.d.ts +0 -18
  200. package/vendor/sdk/node_modules/undici-types/cache.d.ts +0 -36
  201. package/vendor/sdk/node_modules/undici-types/client.d.ts +0 -97
  202. package/vendor/sdk/node_modules/undici-types/connector.d.ts +0 -34
  203. package/vendor/sdk/node_modules/undici-types/content-type.d.ts +0 -21
  204. package/vendor/sdk/node_modules/undici-types/cookies.d.ts +0 -28
  205. package/vendor/sdk/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  206. package/vendor/sdk/node_modules/undici-types/dispatcher.d.ts +0 -241
  207. package/vendor/sdk/node_modules/undici-types/errors.d.ts +0 -128
  208. package/vendor/sdk/node_modules/undici-types/fetch.d.ts +0 -209
  209. package/vendor/sdk/node_modules/undici-types/file.d.ts +0 -39
  210. package/vendor/sdk/node_modules/undici-types/filereader.d.ts +0 -54
  211. package/vendor/sdk/node_modules/undici-types/formdata.d.ts +0 -108
  212. package/vendor/sdk/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  213. package/vendor/sdk/node_modules/undici-types/global-origin.d.ts +0 -7
  214. package/vendor/sdk/node_modules/undici-types/handlers.d.ts +0 -9
  215. package/vendor/sdk/node_modules/undici-types/header.d.ts +0 -4
  216. package/vendor/sdk/node_modules/undici-types/index.d.ts +0 -63
  217. package/vendor/sdk/node_modules/undici-types/interceptors.d.ts +0 -5
  218. package/vendor/sdk/node_modules/undici-types/mock-agent.d.ts +0 -50
  219. package/vendor/sdk/node_modules/undici-types/mock-client.d.ts +0 -25
  220. package/vendor/sdk/node_modules/undici-types/mock-errors.d.ts +0 -12
  221. package/vendor/sdk/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  222. package/vendor/sdk/node_modules/undici-types/mock-pool.d.ts +0 -25
  223. package/vendor/sdk/node_modules/undici-types/package.json +0 -55
  224. package/vendor/sdk/node_modules/undici-types/patch.d.ts +0 -71
  225. package/vendor/sdk/node_modules/undici-types/pool-stats.d.ts +0 -19
  226. package/vendor/sdk/node_modules/undici-types/pool.d.ts +0 -28
  227. package/vendor/sdk/node_modules/undici-types/proxy-agent.d.ts +0 -30
  228. package/vendor/sdk/node_modules/undici-types/readable.d.ts +0 -61
  229. package/vendor/sdk/node_modules/undici-types/webidl.d.ts +0 -220
  230. package/vendor/sdk/node_modules/undici-types/websocket.d.ts +0 -131
  231. package/vendor/sdk/package.json +0 -124
  232. package/vendor/sdk/pagination.d.ts +0 -27
  233. package/vendor/sdk/pagination.d.ts.map +0 -1
  234. package/vendor/sdk/pagination.js +0 -60
  235. package/vendor/sdk/pagination.js.map +0 -1
  236. package/vendor/sdk/pagination.mjs +0 -56
  237. package/vendor/sdk/pagination.mjs.map +0 -1
  238. package/vendor/sdk/resource.d.ts +0 -6
  239. package/vendor/sdk/resource.d.ts.map +0 -1
  240. package/vendor/sdk/resource.js +0 -11
  241. package/vendor/sdk/resource.js.map +0 -1
  242. package/vendor/sdk/resource.mjs +0 -7
  243. package/vendor/sdk/resource.mjs.map +0 -1
  244. package/vendor/sdk/resources/beta/beta.d.ts +0 -57
  245. package/vendor/sdk/resources/beta/beta.d.ts.map +0 -1
  246. package/vendor/sdk/resources/beta/beta.js +0 -44
  247. package/vendor/sdk/resources/beta/beta.js.map +0 -1
  248. package/vendor/sdk/resources/beta/beta.mjs +0 -17
  249. package/vendor/sdk/resources/beta/beta.mjs.map +0 -1
  250. package/vendor/sdk/resources/beta/index.d.ts +0 -4
  251. package/vendor/sdk/resources/beta/index.d.ts.map +0 -1
  252. package/vendor/sdk/resources/beta/index.js +0 -12
  253. package/vendor/sdk/resources/beta/index.js.map +0 -1
  254. package/vendor/sdk/resources/beta/index.mjs +0 -5
  255. package/vendor/sdk/resources/beta/index.mjs.map +0 -1
  256. package/vendor/sdk/resources/beta/messages/batches.d.ts +0 -289
  257. package/vendor/sdk/resources/beta/messages/batches.d.ts.map +0 -1
  258. package/vendor/sdk/resources/beta/messages/batches.js +0 -112
  259. package/vendor/sdk/resources/beta/messages/batches.js.map +0 -1
  260. package/vendor/sdk/resources/beta/messages/batches.mjs +0 -107
  261. package/vendor/sdk/resources/beta/messages/batches.mjs.map +0 -1
  262. package/vendor/sdk/resources/beta/messages/index.d.ts +0 -3
  263. package/vendor/sdk/resources/beta/messages/index.d.ts.map +0 -1
  264. package/vendor/sdk/resources/beta/messages/index.js +0 -10
  265. package/vendor/sdk/resources/beta/messages/index.js.map +0 -1
  266. package/vendor/sdk/resources/beta/messages/index.mjs +0 -4
  267. package/vendor/sdk/resources/beta/messages/index.mjs.map +0 -1
  268. package/vendor/sdk/resources/beta/messages/messages.d.ts +0 -1038
  269. package/vendor/sdk/resources/beta/messages/messages.d.ts.map +0 -1
  270. package/vendor/sdk/resources/beta/messages/messages.js +0 -93
  271. package/vendor/sdk/resources/beta/messages/messages.js.map +0 -1
  272. package/vendor/sdk/resources/beta/messages/messages.mjs +0 -66
  273. package/vendor/sdk/resources/beta/messages/messages.mjs.map +0 -1
  274. package/vendor/sdk/resources/beta/models.d.ts +0 -49
  275. package/vendor/sdk/resources/beta/models.d.ts.map +0 -1
  276. package/vendor/sdk/resources/beta/models.js +0 -30
  277. package/vendor/sdk/resources/beta/models.js.map +0 -1
  278. package/vendor/sdk/resources/beta/models.mjs +0 -25
  279. package/vendor/sdk/resources/beta/models.mjs.map +0 -1
  280. package/vendor/sdk/resources/completions.d.ts +0 -166
  281. package/vendor/sdk/resources/completions.d.ts.map +0 -1
  282. package/vendor/sdk/resources/completions.js +0 -17
  283. package/vendor/sdk/resources/completions.js.map +0 -1
  284. package/vendor/sdk/resources/completions.mjs +0 -13
  285. package/vendor/sdk/resources/completions.mjs.map +0 -1
  286. package/vendor/sdk/resources/index.d.ts +0 -6
  287. package/vendor/sdk/resources/index.d.ts.map +0 -1
  288. package/vendor/sdk/resources/index.js +0 -29
  289. package/vendor/sdk/resources/index.js.map +0 -1
  290. package/vendor/sdk/resources/index.mjs +0 -7
  291. package/vendor/sdk/resources/index.mjs.map +0 -1
  292. package/vendor/sdk/resources/messages/batches.d.ts +0 -253
  293. package/vendor/sdk/resources/messages/batches.d.ts.map +0 -1
  294. package/vendor/sdk/resources/messages/batches.js +0 -102
  295. package/vendor/sdk/resources/messages/batches.js.map +0 -1
  296. package/vendor/sdk/resources/messages/batches.mjs +0 -97
  297. package/vendor/sdk/resources/messages/batches.mjs.map +0 -1
  298. package/vendor/sdk/resources/messages/index.d.ts +0 -3
  299. package/vendor/sdk/resources/messages/index.d.ts.map +0 -1
  300. package/vendor/sdk/resources/messages/index.js +0 -10
  301. package/vendor/sdk/resources/messages/index.js.map +0 -1
  302. package/vendor/sdk/resources/messages/index.mjs +0 -4
  303. package/vendor/sdk/resources/messages/index.mjs.map +0 -1
  304. package/vendor/sdk/resources/messages/messages.d.ts +0 -1028
  305. package/vendor/sdk/resources/messages/messages.d.ts.map +0 -1
  306. package/vendor/sdk/resources/messages/messages.js +0 -82
  307. package/vendor/sdk/resources/messages/messages.js.map +0 -1
  308. package/vendor/sdk/resources/messages/messages.mjs +0 -54
  309. package/vendor/sdk/resources/messages/messages.mjs.map +0 -1
  310. package/vendor/sdk/resources/models.d.ts +0 -49
  311. package/vendor/sdk/resources/models.d.ts.map +0 -1
  312. package/vendor/sdk/resources/models.js +0 -30
  313. package/vendor/sdk/resources/models.js.map +0 -1
  314. package/vendor/sdk/resources/models.mjs +0 -25
  315. package/vendor/sdk/resources/models.mjs.map +0 -1
  316. package/vendor/sdk/resources/shared.d.ts +0 -42
  317. package/vendor/sdk/resources/shared.d.ts.map +0 -1
  318. package/vendor/sdk/resources/shared.js +0 -4
  319. package/vendor/sdk/resources/shared.js.map +0 -1
  320. package/vendor/sdk/resources/shared.mjs +0 -3
  321. package/vendor/sdk/resources/shared.mjs.map +0 -1
  322. package/vendor/sdk/resources/top-level.d.ts +0 -2
  323. package/vendor/sdk/resources/top-level.d.ts.map +0 -1
  324. package/vendor/sdk/resources/top-level.js +0 -4
  325. package/vendor/sdk/resources/top-level.js.map +0 -1
  326. package/vendor/sdk/resources/top-level.mjs +0 -3
  327. package/vendor/sdk/resources/top-level.mjs.map +0 -1
  328. package/vendor/sdk/shims/node.d.ts +0 -30
  329. package/vendor/sdk/shims/node.d.ts.map +0 -1
  330. package/vendor/sdk/shims/node.js +0 -31
  331. package/vendor/sdk/shims/node.js.map +0 -1
  332. package/vendor/sdk/shims/node.mjs +0 -5
  333. package/vendor/sdk/shims/node.mjs.map +0 -1
  334. package/vendor/sdk/shims/web.d.ts +0 -26
  335. package/vendor/sdk/shims/web.d.ts.map +0 -1
  336. package/vendor/sdk/shims/web.js +0 -31
  337. package/vendor/sdk/shims/web.js.map +0 -1
  338. package/vendor/sdk/shims/web.mjs +0 -5
  339. package/vendor/sdk/shims/web.mjs.map +0 -1
  340. package/vendor/sdk/src/_shims/MultipartBody.ts +0 -9
  341. package/vendor/sdk/src/_shims/README.md +0 -46
  342. package/vendor/sdk/src/_shims/auto/runtime-bun.ts +0 -4
  343. package/vendor/sdk/src/_shims/auto/runtime-node.ts +0 -4
  344. package/vendor/sdk/src/_shims/auto/runtime.ts +0 -4
  345. package/vendor/sdk/src/_shims/auto/types-node.ts +0 -4
  346. package/vendor/sdk/src/_shims/auto/types.d.ts +0 -101
  347. package/vendor/sdk/src/_shims/auto/types.js +0 -3
  348. package/vendor/sdk/src/_shims/auto/types.mjs +0 -3
  349. package/vendor/sdk/src/_shims/bun-runtime.ts +0 -14
  350. package/vendor/sdk/src/_shims/index.d.ts +0 -81
  351. package/vendor/sdk/src/_shims/index.js +0 -13
  352. package/vendor/sdk/src/_shims/index.mjs +0 -7
  353. package/vendor/sdk/src/_shims/manual-types.d.ts +0 -12
  354. package/vendor/sdk/src/_shims/manual-types.js +0 -3
  355. package/vendor/sdk/src/_shims/manual-types.mjs +0 -3
  356. package/vendor/sdk/src/_shims/node-runtime.ts +0 -81
  357. package/vendor/sdk/src/_shims/node-types.d.ts +0 -42
  358. package/vendor/sdk/src/_shims/node-types.js +0 -3
  359. package/vendor/sdk/src/_shims/node-types.mjs +0 -3
  360. package/vendor/sdk/src/_shims/registry.ts +0 -67
  361. package/vendor/sdk/src/_shims/web-runtime.ts +0 -103
  362. package/vendor/sdk/src/_shims/web-types.d.ts +0 -83
  363. package/vendor/sdk/src/_shims/web-types.js +0 -3
  364. package/vendor/sdk/src/_shims/web-types.mjs +0 -3
  365. package/vendor/sdk/src/_vendor/partial-json-parser/README.md +0 -3
  366. package/vendor/sdk/src/_vendor/partial-json-parser/parser.ts +0 -264
  367. package/vendor/sdk/src/core.ts +0 -1250
  368. package/vendor/sdk/src/error.ts +0 -133
  369. package/vendor/sdk/src/index.ts +0 -465
  370. package/vendor/sdk/src/internal/decoders/jsonl.ts +0 -41
  371. package/vendor/sdk/src/internal/decoders/line.ts +0 -145
  372. package/vendor/sdk/src/internal/stream-utils.ts +0 -32
  373. package/vendor/sdk/src/lib/.keep +0 -4
  374. package/vendor/sdk/src/lib/BetaMessageStream.ts +0 -661
  375. package/vendor/sdk/src/lib/MessageStream.ts +0 -662
  376. package/vendor/sdk/src/pagination.ts +0 -92
  377. package/vendor/sdk/src/resource.ts +0 -11
  378. package/vendor/sdk/src/resources/beta/beta.ts +0 -249
  379. package/vendor/sdk/src/resources/beta/index.ts +0 -83
  380. package/vendor/sdk/src/resources/beta/messages/batches.ts +0 -486
  381. package/vendor/sdk/src/resources/beta/messages/index.ts +0 -87
  382. package/vendor/sdk/src/resources/beta/messages/messages.ts +0 -1444
  383. package/vendor/sdk/src/resources/beta/models.ts +0 -78
  384. package/vendor/sdk/src/resources/completions.ts +0 -210
  385. package/vendor/sdk/src/resources/index.ts +0 -95
  386. package/vendor/sdk/src/resources/messages/batches.ts +0 -352
  387. package/vendor/sdk/src/resources/messages/index.ts +0 -85
  388. package/vendor/sdk/src/resources/messages/messages.ts +0 -1412
  389. package/vendor/sdk/src/resources/models.ts +0 -75
  390. package/vendor/sdk/src/resources/shared.ts +0 -72
  391. package/vendor/sdk/src/resources/top-level.ts +0 -3
  392. package/vendor/sdk/src/shims/node.ts +0 -50
  393. package/vendor/sdk/src/shims/web.ts +0 -50
  394. package/vendor/sdk/src/streaming.ts +0 -372
  395. package/vendor/sdk/src/tsconfig.json +0 -11
  396. package/vendor/sdk/src/uploads.ts +0 -255
  397. package/vendor/sdk/src/version.ts +0 -1
  398. package/vendor/sdk/streaming.d.ts +0 -36
  399. package/vendor/sdk/streaming.d.ts.map +0 -1
  400. package/vendor/sdk/streaming.js +0 -316
  401. package/vendor/sdk/streaming.js.map +0 -1
  402. package/vendor/sdk/streaming.mjs +0 -310
  403. package/vendor/sdk/streaming.mjs.map +0 -1
  404. package/vendor/sdk/uploads.d.ts +0 -75
  405. package/vendor/sdk/uploads.d.ts.map +0 -1
  406. package/vendor/sdk/uploads.js +0 -171
  407. package/vendor/sdk/uploads.js.map +0 -1
  408. package/vendor/sdk/uploads.mjs +0 -158
  409. package/vendor/sdk/uploads.mjs.map +0 -1
  410. package/vendor/sdk/version.d.ts +0 -2
  411. package/vendor/sdk/version.d.ts.map +0 -1
  412. package/vendor/sdk/version.js +0 -5
  413. package/vendor/sdk/version.js.map +0 -1
  414. package/vendor/sdk/version.mjs +0 -2
  415. package/vendor/sdk/version.mjs.map +0 -1
@@ -1,1549 +0,0 @@
1
- /**
2
- * The `child_process` module provides the ability to spawn subprocesses in
3
- * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
4
- * is primarily provided by the {@link spawn} function:
5
- *
6
- * ```js
7
- * import { spawn } from 'node:child_process';
8
- * const ls = spawn('ls', ['-lh', '/usr']);
9
- *
10
- * ls.stdout.on('data', (data) => {
11
- * console.log(`stdout: ${data}`);
12
- * });
13
- *
14
- * ls.stderr.on('data', (data) => {
15
- * console.error(`stderr: ${data}`);
16
- * });
17
- *
18
- * ls.on('close', (code) => {
19
- * console.log(`child process exited with code ${code}`);
20
- * });
21
- * ```
22
- *
23
- * By default, pipes for `stdin`, `stdout`, and `stderr` are established between
24
- * the parent Node.js process and the spawned subprocess. These pipes have
25
- * limited (and platform-specific) capacity. If the subprocess writes to
26
- * stdout in excess of that limit without the output being captured, the
27
- * subprocess blocks waiting for the pipe buffer to accept more data. This is
28
- * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
29
- *
30
- * The command lookup is performed using the `options.env.PATH` environment
31
- * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
32
- * used. If `options.env` is set without `PATH`, lookup on Unix is performed
33
- * on a default search path search of `/usr/bin:/bin` (see your operating system's
34
- * manual for execvpe/execvp), on Windows the current processes environment
35
- * variable `PATH` is used.
36
- *
37
- * On Windows, environment variables are case-insensitive. Node.js
38
- * lexicographically sorts the `env` keys and uses the first one that
39
- * case-insensitively matches. Only first (in lexicographic order) entry will be
40
- * passed to the subprocess. This might lead to issues on Windows when passing
41
- * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`.
42
- *
43
- * The {@link spawn} method spawns the child process asynchronously,
44
- * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
45
- * the event loop until the spawned process either exits or is terminated.
46
- *
47
- * For convenience, the `child_process` module provides a handful of synchronous
48
- * and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
49
- * top of {@link spawn} or {@link spawnSync}.
50
- *
51
- * * {@link exec}: spawns a shell and runs a command within that
52
- * shell, passing the `stdout` and `stderr` to a callback function when
53
- * complete.
54
- * * {@link execFile}: similar to {@link exec} except
55
- * that it spawns the command directly without first spawning a shell by
56
- * default.
57
- * * {@link fork}: spawns a new Node.js process and invokes a
58
- * specified module with an IPC communication channel established that allows
59
- * sending messages between parent and child.
60
- * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop.
61
- * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop.
62
- *
63
- * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
64
- * the synchronous methods can have significant impact on performance due to
65
- * stalling the event loop while spawned processes complete.
66
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
67
- */
68
- declare module "child_process" {
69
- import { ObjectEncodingOptions } from "node:fs";
70
- import { Abortable, EventEmitter } from "node:events";
71
- import * as net from "node:net";
72
- import { Pipe, Readable, Stream, Writable } from "node:stream";
73
- import { URL } from "node:url";
74
- type Serializable = string | object | number | boolean | bigint;
75
- type SendHandle = net.Socket | net.Server;
76
- /**
77
- * Instances of the `ChildProcess` represent spawned child processes.
78
- *
79
- * Instances of `ChildProcess` are not intended to be created directly. Rather,
80
- * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create
81
- * instances of `ChildProcess`.
82
- * @since v2.2.0
83
- */
84
- class ChildProcess extends EventEmitter {
85
- /**
86
- * A `Writable Stream` that represents the child process's `stdin`.
87
- *
88
- * If a child process waits to read all of its input, the child will not continue
89
- * until this stream has been closed via `end()`.
90
- *
91
- * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`,
92
- * then this will be `null`.
93
- *
94
- * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
95
- * refer to the same value.
96
- *
97
- * The `subprocess.stdin` property can be `undefined` if the child process could
98
- * not be successfully spawned.
99
- * @since v0.1.90
100
- */
101
- stdin: Writable | null;
102
- /**
103
- * A `Readable Stream` that represents the child process's `stdout`.
104
- *
105
- * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`,
106
- * then this will be `null`.
107
- *
108
- * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
109
- * refer to the same value.
110
- *
111
- * ```js
112
- * import { spawn } from 'node:child_process';
113
- *
114
- * const subprocess = spawn('ls');
115
- *
116
- * subprocess.stdout.on('data', (data) => {
117
- * console.log(`Received chunk ${data}`);
118
- * });
119
- * ```
120
- *
121
- * The `subprocess.stdout` property can be `null` if the child process could
122
- * not be successfully spawned.
123
- * @since v0.1.90
124
- */
125
- stdout: Readable | null;
126
- /**
127
- * A `Readable Stream` that represents the child process's `stderr`.
128
- *
129
- * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`,
130
- * then this will be `null`.
131
- *
132
- * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
133
- * refer to the same value.
134
- *
135
- * The `subprocess.stderr` property can be `null` if the child process could
136
- * not be successfully spawned.
137
- * @since v0.1.90
138
- */
139
- stderr: Readable | null;
140
- /**
141
- * The `subprocess.channel` property is a reference to the child's IPC channel. If
142
- * no IPC channel currently exists, this property is `undefined`.
143
- * @since v7.1.0
144
- */
145
- readonly channel?: Pipe | null | undefined;
146
- /**
147
- * A sparse array of pipes to the child process, corresponding with positions in
148
- * the `stdio` option passed to {@link spawn} that have been set
149
- * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`,
150
- * respectively.
151
- *
152
- * In the following example, only the child's fd `1` (stdout) is configured as a
153
- * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values
154
- * in the array are `null`.
155
- *
156
- * ```js
157
- * import assert from 'node:assert';
158
- * import fs from 'node:fs';
159
- * import child_process from 'node:child_process';
160
- *
161
- * const subprocess = child_process.spawn('ls', {
162
- * stdio: [
163
- * 0, // Use parent's stdin for child.
164
- * 'pipe', // Pipe child's stdout to parent.
165
- * fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
166
- * ]
167
- * });
168
- *
169
- * assert.strictEqual(subprocess.stdio[0], null);
170
- * assert.strictEqual(subprocess.stdio[0], subprocess.stdin);
171
- *
172
- * assert(subprocess.stdout);
173
- * assert.strictEqual(subprocess.stdio[1], subprocess.stdout);
174
- *
175
- * assert.strictEqual(subprocess.stdio[2], null);
176
- * assert.strictEqual(subprocess.stdio[2], subprocess.stderr);
177
- * ```
178
- *
179
- * The `subprocess.stdio` property can be `undefined` if the child process could
180
- * not be successfully spawned.
181
- * @since v0.7.10
182
- */
183
- readonly stdio: [
184
- Writable | null,
185
- // stdin
186
- Readable | null,
187
- // stdout
188
- Readable | null,
189
- // stderr
190
- Readable | Writable | null | undefined,
191
- // extra
192
- Readable | Writable | null | undefined, // extra
193
- ];
194
- /**
195
- * The `subprocess.killed` property indicates whether the child process
196
- * successfully received a signal from `subprocess.kill()`. The `killed` property
197
- * does not indicate that the child process has been terminated.
198
- * @since v0.5.10
199
- */
200
- readonly killed: boolean;
201
- /**
202
- * Returns the process identifier (PID) of the child process. If the child process
203
- * fails to spawn due to errors, then the value is `undefined` and `error` is
204
- * emitted.
205
- *
206
- * ```js
207
- * import { spawn } from 'node:child_process';
208
- * const grep = spawn('grep', ['ssh']);
209
- *
210
- * console.log(`Spawned child pid: ${grep.pid}`);
211
- * grep.stdin.end();
212
- * ```
213
- * @since v0.1.90
214
- */
215
- readonly pid?: number | undefined;
216
- /**
217
- * The `subprocess.connected` property indicates whether it is still possible to
218
- * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages.
219
- * @since v0.7.2
220
- */
221
- readonly connected: boolean;
222
- /**
223
- * The `subprocess.exitCode` property indicates the exit code of the child process.
224
- * If the child process is still running, the field will be `null`.
225
- */
226
- readonly exitCode: number | null;
227
- /**
228
- * The `subprocess.signalCode` property indicates the signal received by
229
- * the child process if any, else `null`.
230
- */
231
- readonly signalCode: NodeJS.Signals | null;
232
- /**
233
- * The `subprocess.spawnargs` property represents the full list of command-line
234
- * arguments the child process was launched with.
235
- */
236
- readonly spawnargs: string[];
237
- /**
238
- * The `subprocess.spawnfile` property indicates the executable file name of
239
- * the child process that is launched.
240
- *
241
- * For {@link fork}, its value will be equal to `process.execPath`.
242
- * For {@link spawn}, its value will be the name of
243
- * the executable file.
244
- * For {@link exec}, its value will be the name of the shell
245
- * in which the child process is launched.
246
- */
247
- readonly spawnfile: string;
248
- /**
249
- * The `subprocess.kill()` method sends a signal to the child process. If no
250
- * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
251
- * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
252
- *
253
- * ```js
254
- * import { spawn } from 'node:child_process';
255
- * const grep = spawn('grep', ['ssh']);
256
- *
257
- * grep.on('close', (code, signal) => {
258
- * console.log(
259
- * `child process terminated due to receipt of signal ${signal}`);
260
- * });
261
- *
262
- * // Send SIGHUP to process.
263
- * grep.kill('SIGHUP');
264
- * ```
265
- *
266
- * The `ChildProcess` object may emit an `'error'` event if the signal
267
- * cannot be delivered. Sending a signal to a child process that has already exited
268
- * is not an error but may have unforeseen consequences. Specifically, if the
269
- * process identifier (PID) has been reassigned to another process, the signal will
270
- * be delivered to that process instead which can have unexpected results.
271
- *
272
- * While the function is called `kill`, the signal delivered to the child process
273
- * may not actually terminate the process.
274
- *
275
- * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
276
- *
277
- * On Windows, where POSIX signals do not exist, the `signal` argument will be
278
- * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`).
279
- * See `Signal Events` for more details.
280
- *
281
- * On Linux, child processes of child processes will not be terminated
282
- * when attempting to kill their parent. This is likely to happen when running a
283
- * new process in a shell or with the use of the `shell` option of `ChildProcess`:
284
- *
285
- * ```js
286
- * 'use strict';
287
- * import { spawn } from 'node:child_process';
288
- *
289
- * const subprocess = spawn(
290
- * 'sh',
291
- * [
292
- * '-c',
293
- * `node -e "setInterval(() => {
294
- * console.log(process.pid, 'is alive')
295
- * }, 500);"`,
296
- * ], {
297
- * stdio: ['inherit', 'inherit', 'inherit']
298
- * }
299
- * );
300
- *
301
- * setTimeout(() => {
302
- * subprocess.kill(); // Does not terminate the Node.js process in the shell.
303
- * }, 2000);
304
- * ```
305
- * @since v0.1.90
306
- */
307
- kill(signal?: NodeJS.Signals | number): boolean;
308
- /**
309
- * Calls {@link ChildProcess.kill} with `'SIGTERM'`.
310
- * @since v18.18.0
311
- */
312
- [Symbol.dispose](): void;
313
- /**
314
- * When an IPC channel has been established between the parent and child (
315
- * i.e. when using {@link fork}), the `subprocess.send()` method can
316
- * be used to send messages to the child process. When the child process is a
317
- * Node.js instance, these messages can be received via the `'message'` event.
318
- *
319
- * The message goes through serialization and parsing. The resulting
320
- * message might not be the same as what is originally sent.
321
- *
322
- * For example, in the parent script:
323
- *
324
- * ```js
325
- * import cp from 'node:child_process';
326
- * const n = cp.fork(`${__dirname}/sub.js`);
327
- *
328
- * n.on('message', (m) => {
329
- * console.log('PARENT got message:', m);
330
- * });
331
- *
332
- * // Causes the child to print: CHILD got message: { hello: 'world' }
333
- * n.send({ hello: 'world' });
334
- * ```
335
- *
336
- * And then the child script, `'sub.js'` might look like this:
337
- *
338
- * ```js
339
- * process.on('message', (m) => {
340
- * console.log('CHILD got message:', m);
341
- * });
342
- *
343
- * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null }
344
- * process.send({ foo: 'bar', baz: NaN });
345
- * ```
346
- *
347
- * Child Node.js processes will have a `process.send()` method of their own
348
- * that allows the child to send messages back to the parent.
349
- *
350
- * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
351
- * containing a `NODE_` prefix in the `cmd` property are reserved for use within
352
- * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js.
353
- * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice.
354
- *
355
- * The optional `sendHandle` argument that may be passed to `subprocess.send()` is
356
- * for passing a TCP server or socket object to the child process. The child will
357
- * receive the object as the second argument passed to the callback function
358
- * registered on the `'message'` event. Any data that is received
359
- * and buffered in the socket will not be sent to the child.
360
- *
361
- * The optional `callback` is a function that is invoked after the message is
362
- * sent but before the child may have received it. The function is called with a
363
- * single argument: `null` on success, or an `Error` object on failure.
364
- *
365
- * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can
366
- * happen, for instance, when the child process has already exited.
367
- *
368
- * `subprocess.send()` will return `false` if the channel has closed or when the
369
- * backlog of unsent messages exceeds a threshold that makes it unwise to send
370
- * more. Otherwise, the method returns `true`. The `callback` function can be
371
- * used to implement flow control.
372
- *
373
- * #### Example: sending a server object
374
- *
375
- * The `sendHandle` argument can be used, for instance, to pass the handle of
376
- * a TCP server object to the child process as illustrated in the example below:
377
- *
378
- * ```js
379
- * import child_process from 'node:child_process';
380
- * const subprocess = child_process.fork('subprocess.js');
381
- *
382
- * // Open up the server object and send the handle.
383
- * import net from 'node:net';
384
- * const server = net.createServer();
385
- * server.on('connection', (socket) => {
386
- * socket.end('handled by parent');
387
- * });
388
- * server.listen(1337, () => {
389
- * subprocess.send('server', server);
390
- * });
391
- * ```
392
- *
393
- * The child would then receive the server object as:
394
- *
395
- * ```js
396
- * process.on('message', (m, server) => {
397
- * if (m === 'server') {
398
- * server.on('connection', (socket) => {
399
- * socket.end('handled by child');
400
- * });
401
- * }
402
- * });
403
- * ```
404
- *
405
- * Once the server is now shared between the parent and child, some connections
406
- * can be handled by the parent and some by the child.
407
- *
408
- * While the example above uses a server created using the `net` module, `dgram`module servers use exactly the same workflow with the exceptions of listening on
409
- * a `'message'` event instead of `'connection'` and using `server.bind()` instead
410
- * of `server.listen()`. This is, however, currently only supported on Unix
411
- * platforms.
412
- *
413
- * #### Example: sending a socket object
414
- *
415
- * Similarly, the `sendHandler` argument can be used to pass the handle of a
416
- * socket to the child process. The example below spawns two children that each
417
- * handle connections with "normal" or "special" priority:
418
- *
419
- * ```js
420
- * import { fork } from 'node:child_process';
421
- * const normal = fork('subprocess.js', ['normal']);
422
- * const special = fork('subprocess.js', ['special']);
423
- *
424
- * // Open up the server and send sockets to child. Use pauseOnConnect to prevent
425
- * // the sockets from being read before they are sent to the child proces
426
- * import net from 'node:net';
427
- * const server = met.createServer({ pauseOnConnect: true });
428
- * server.on('connection', (socket) => {
429
- *
430
- * // If this is special priority...
431
- * if (socket.remoteAddress === '74.125.127.100') {
432
- * special.send('socket', socket);
433
- * return;
434
- * }
435
- * // This is normal priority.
436
- * normal.send('socket', socket);
437
- * });
438
- * server.listen(1337);
439
- * ```
440
- *
441
- * The `subprocess.js` would receive the socket handle as the second argument
442
- * passed to the event callback function:
443
- *
444
- * ```js
445
- * process.on('message', (m, socket) => {
446
- * if (m === 'socket') {
447
- * if (socket) {
448
- * // Check that the client socket exists.
449
- * // It is possible for the socket to be closed between the time it is
450
- * // sent and the time it is received in the child process.
451
- * socket.end(`Request handled with ${process.argv[2]} priority`);
452
- * }
453
- * }
454
- * });
455
- * ```
456
- *
457
- * Do not use `.maxConnections` on a socket that has been passed to a subprocess.
458
- * The parent cannot track when the socket is destroyed.
459
- *
460
- * Any `'message'` handlers in the subprocess should verify that `socket` exists,
461
- * as the connection may have been closed during the time it takes to send the
462
- * connection to the child.
463
- * @since v0.5.9
464
- * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
465
- */
466
- send(message: Serializable, callback?: (error: Error | null) => void): boolean;
467
- send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
468
- send(
469
- message: Serializable,
470
- sendHandle?: SendHandle,
471
- options?: MessageOptions,
472
- callback?: (error: Error | null) => void,
473
- ): boolean;
474
- /**
475
- * Closes the IPC channel between parent and child, allowing the child to exit
476
- * gracefully once there are no other connections keeping it alive. After calling
477
- * this method the `subprocess.connected` and `process.connected` properties in
478
- * both the parent and child (respectively) will be set to `false`, and it will be
479
- * no longer possible to pass messages between the processes.
480
- *
481
- * The `'disconnect'` event will be emitted when there are no messages in the
482
- * process of being received. This will most often be triggered immediately after
483
- * calling `subprocess.disconnect()`.
484
- *
485
- * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked
486
- * within the child process to close the IPC channel as well.
487
- * @since v0.7.2
488
- */
489
- disconnect(): void;
490
- /**
491
- * By default, the parent will wait for the detached child to exit. To prevent the
492
- * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not
493
- * include the child in its reference count, allowing the parent to exit
494
- * independently of the child, unless there is an established IPC channel between
495
- * the child and the parent.
496
- *
497
- * ```js
498
- * import { spawn } from 'node:child_process';
499
- *
500
- * const subprocess = spawn(process.argv[0], ['child_program.js'], {
501
- * detached: true,
502
- * stdio: 'ignore'
503
- * });
504
- *
505
- * subprocess.unref();
506
- * ```
507
- * @since v0.7.10
508
- */
509
- unref(): void;
510
- /**
511
- * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will
512
- * restore the removed reference count for the child process, forcing the parent
513
- * to wait for the child to exit before exiting itself.
514
- *
515
- * ```js
516
- * import { spawn } from 'node:child_process';
517
- *
518
- * const subprocess = spawn(process.argv[0], ['child_program.js'], {
519
- * detached: true,
520
- * stdio: 'ignore'
521
- * });
522
- *
523
- * subprocess.unref();
524
- * subprocess.ref();
525
- * ```
526
- * @since v0.7.10
527
- */
528
- ref(): void;
529
- /**
530
- * events.EventEmitter
531
- * 1. close
532
- * 2. disconnect
533
- * 3. error
534
- * 4. exit
535
- * 5. message
536
- * 6. spawn
537
- */
538
- addListener(event: string, listener: (...args: any[]) => void): this;
539
- addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
540
- addListener(event: "disconnect", listener: () => void): this;
541
- addListener(event: "error", listener: (err: Error) => void): this;
542
- addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
543
- addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
544
- addListener(event: "spawn", listener: () => void): this;
545
- emit(event: string | symbol, ...args: any[]): boolean;
546
- emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
547
- emit(event: "disconnect"): boolean;
548
- emit(event: "error", err: Error): boolean;
549
- emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
550
- emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
551
- emit(event: "spawn", listener: () => void): boolean;
552
- on(event: string, listener: (...args: any[]) => void): this;
553
- on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
554
- on(event: "disconnect", listener: () => void): this;
555
- on(event: "error", listener: (err: Error) => void): this;
556
- on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
557
- on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
558
- on(event: "spawn", listener: () => void): this;
559
- once(event: string, listener: (...args: any[]) => void): this;
560
- once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
561
- once(event: "disconnect", listener: () => void): this;
562
- once(event: "error", listener: (err: Error) => void): this;
563
- once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
564
- once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
565
- once(event: "spawn", listener: () => void): this;
566
- prependListener(event: string, listener: (...args: any[]) => void): this;
567
- prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
568
- prependListener(event: "disconnect", listener: () => void): this;
569
- prependListener(event: "error", listener: (err: Error) => void): this;
570
- prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
571
- prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
572
- prependListener(event: "spawn", listener: () => void): this;
573
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
574
- prependOnceListener(
575
- event: "close",
576
- listener: (code: number | null, signal: NodeJS.Signals | null) => void,
577
- ): this;
578
- prependOnceListener(event: "disconnect", listener: () => void): this;
579
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
580
- prependOnceListener(
581
- event: "exit",
582
- listener: (code: number | null, signal: NodeJS.Signals | null) => void,
583
- ): this;
584
- prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
585
- prependOnceListener(event: "spawn", listener: () => void): this;
586
- }
587
- // return this object when stdio option is undefined or not specified
588
- interface ChildProcessWithoutNullStreams extends ChildProcess {
589
- stdin: Writable;
590
- stdout: Readable;
591
- stderr: Readable;
592
- readonly stdio: [
593
- Writable,
594
- Readable,
595
- Readable,
596
- // stderr
597
- Readable | Writable | null | undefined,
598
- // extra, no modification
599
- Readable | Writable | null | undefined, // extra, no modification
600
- ];
601
- }
602
- // return this object when stdio option is a tuple of 3
603
- interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
604
- extends ChildProcess
605
- {
606
- stdin: I;
607
- stdout: O;
608
- stderr: E;
609
- readonly stdio: [
610
- I,
611
- O,
612
- E,
613
- Readable | Writable | null | undefined,
614
- // extra, no modification
615
- Readable | Writable | null | undefined, // extra, no modification
616
- ];
617
- }
618
- interface MessageOptions {
619
- keepOpen?: boolean | undefined;
620
- }
621
- type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
622
- type StdioOptions = IOType | Array<IOType | "ipc" | Stream | number | null | undefined>;
623
- type SerializationType = "json" | "advanced";
624
- interface MessagingOptions extends Abortable {
625
- /**
626
- * Specify the kind of serialization used for sending messages between processes.
627
- * @default 'json'
628
- */
629
- serialization?: SerializationType | undefined;
630
- /**
631
- * The signal value to be used when the spawned process will be killed by the abort signal.
632
- * @default 'SIGTERM'
633
- */
634
- killSignal?: NodeJS.Signals | number | undefined;
635
- /**
636
- * In milliseconds the maximum amount of time the process is allowed to run.
637
- */
638
- timeout?: number | undefined;
639
- }
640
- interface ProcessEnvOptions {
641
- uid?: number | undefined;
642
- gid?: number | undefined;
643
- cwd?: string | URL | undefined;
644
- env?: NodeJS.ProcessEnv | undefined;
645
- }
646
- interface CommonOptions extends ProcessEnvOptions {
647
- /**
648
- * @default false
649
- */
650
- windowsHide?: boolean | undefined;
651
- /**
652
- * @default 0
653
- */
654
- timeout?: number | undefined;
655
- }
656
- interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
657
- argv0?: string | undefined;
658
- /**
659
- * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
660
- * If passed as an array, the first element is used for `stdin`, the second for
661
- * `stdout`, and the third for `stderr`. A fourth element can be used to
662
- * specify the `stdio` behavior beyond the standard streams. See
663
- * {@link ChildProcess.stdio} for more information.
664
- *
665
- * @default 'pipe'
666
- */
667
- stdio?: StdioOptions | undefined;
668
- shell?: boolean | string | undefined;
669
- windowsVerbatimArguments?: boolean | undefined;
670
- }
671
- interface SpawnOptions extends CommonSpawnOptions {
672
- detached?: boolean | undefined;
673
- }
674
- interface SpawnOptionsWithoutStdio extends SpawnOptions {
675
- stdio?: StdioPipeNamed | StdioPipe[] | undefined;
676
- }
677
- type StdioNull = "inherit" | "ignore" | Stream;
678
- type StdioPipeNamed = "pipe" | "overlapped";
679
- type StdioPipe = undefined | null | StdioPipeNamed;
680
- interface SpawnOptionsWithStdioTuple<
681
- Stdin extends StdioNull | StdioPipe,
682
- Stdout extends StdioNull | StdioPipe,
683
- Stderr extends StdioNull | StdioPipe,
684
- > extends SpawnOptions {
685
- stdio: [Stdin, Stdout, Stderr];
686
- }
687
- /**
688
- * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults
689
- * to an empty array.
690
- *
691
- * **If the `shell` option is enabled, do not pass unsanitized user input to this**
692
- * **function. Any input containing shell metacharacters may be used to trigger**
693
- * **arbitrary command execution.**
694
- *
695
- * A third argument may be used to specify additional options, with these defaults:
696
- *
697
- * ```js
698
- * const defaults = {
699
- * cwd: undefined,
700
- * env: process.env
701
- * };
702
- * ```
703
- *
704
- * Use `cwd` to specify the working directory from which the process is spawned.
705
- * If not given, the default is to inherit the current working directory. If given,
706
- * but the path does not exist, the child process emits an `ENOENT` error
707
- * and exits immediately. `ENOENT` is also emitted when the command
708
- * does not exist.
709
- *
710
- * Use `env` to specify environment variables that will be visible to the new
711
- * process, the default is `process.env`.
712
- *
713
- * `undefined` values in `env` will be ignored.
714
- *
715
- * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the
716
- * exit code:
717
- *
718
- * ```js
719
- * import { spawn } from 'node:child_process';
720
- * const ls = spawn('ls', ['-lh', '/usr']);
721
- *
722
- * ls.stdout.on('data', (data) => {
723
- * console.log(`stdout: ${data}`);
724
- * });
725
- *
726
- * ls.stderr.on('data', (data) => {
727
- * console.error(`stderr: ${data}`);
728
- * });
729
- *
730
- * ls.on('close', (code) => {
731
- * console.log(`child process exited with code ${code}`);
732
- * });
733
- * ```
734
- *
735
- * Example: A very elaborate way to run `ps ax | grep ssh`
736
- *
737
- * ```js
738
- * import { spawn } from 'node:child_process';
739
- * const ps = spawn('ps', ['ax']);
740
- * const grep = spawn('grep', ['ssh']);
741
- *
742
- * ps.stdout.on('data', (data) => {
743
- * grep.stdin.write(data);
744
- * });
745
- *
746
- * ps.stderr.on('data', (data) => {
747
- * console.error(`ps stderr: ${data}`);
748
- * });
749
- *
750
- * ps.on('close', (code) => {
751
- * if (code !== 0) {
752
- * console.log(`ps process exited with code ${code}`);
753
- * }
754
- * grep.stdin.end();
755
- * });
756
- *
757
- * grep.stdout.on('data', (data) => {
758
- * console.log(data.toString());
759
- * });
760
- *
761
- * grep.stderr.on('data', (data) => {
762
- * console.error(`grep stderr: ${data}`);
763
- * });
764
- *
765
- * grep.on('close', (code) => {
766
- * if (code !== 0) {
767
- * console.log(`grep process exited with code ${code}`);
768
- * }
769
- * });
770
- * ```
771
- *
772
- * Example of checking for failed `spawn`:
773
- *
774
- * ```js
775
- * import { spawn } from 'node:child_process';
776
- * const subprocess = spawn('bad_command');
777
- *
778
- * subprocess.on('error', (err) => {
779
- * console.error('Failed to start subprocess.');
780
- * });
781
- * ```
782
- *
783
- * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
784
- * title while others (Windows, SunOS) will use `command`.
785
- *
786
- * Node.js currently overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent,
787
- * retrieve it with the`process.argv0` property instead.
788
- *
789
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
790
- * the error passed to the callback will be an `AbortError`:
791
- *
792
- * ```js
793
- * import { spawn } from 'node:child_process';
794
- * const controller = new AbortController();
795
- * const { signal } = controller;
796
- * const grep = spawn('grep', ['ssh'], { signal });
797
- * grep.on('error', (err) => {
798
- * // This will be called with err being an AbortError if the controller aborts
799
- * });
800
- * controller.abort(); // Stops the child process
801
- * ```
802
- * @since v0.1.90
803
- * @param command The command to run.
804
- * @param args List of string arguments.
805
- */
806
- function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
807
- function spawn(
808
- command: string,
809
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
810
- ): ChildProcessByStdio<Writable, Readable, Readable>;
811
- function spawn(
812
- command: string,
813
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
814
- ): ChildProcessByStdio<Writable, Readable, null>;
815
- function spawn(
816
- command: string,
817
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
818
- ): ChildProcessByStdio<Writable, null, Readable>;
819
- function spawn(
820
- command: string,
821
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
822
- ): ChildProcessByStdio<null, Readable, Readable>;
823
- function spawn(
824
- command: string,
825
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
826
- ): ChildProcessByStdio<Writable, null, null>;
827
- function spawn(
828
- command: string,
829
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
830
- ): ChildProcessByStdio<null, Readable, null>;
831
- function spawn(
832
- command: string,
833
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
834
- ): ChildProcessByStdio<null, null, Readable>;
835
- function spawn(
836
- command: string,
837
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
838
- ): ChildProcessByStdio<null, null, null>;
839
- function spawn(command: string, options: SpawnOptions): ChildProcess;
840
- // overloads of spawn with 'args'
841
- function spawn(
842
- command: string,
843
- args?: readonly string[],
844
- options?: SpawnOptionsWithoutStdio,
845
- ): ChildProcessWithoutNullStreams;
846
- function spawn(
847
- command: string,
848
- args: readonly string[],
849
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
850
- ): ChildProcessByStdio<Writable, Readable, Readable>;
851
- function spawn(
852
- command: string,
853
- args: readonly string[],
854
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
855
- ): ChildProcessByStdio<Writable, Readable, null>;
856
- function spawn(
857
- command: string,
858
- args: readonly string[],
859
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
860
- ): ChildProcessByStdio<Writable, null, Readable>;
861
- function spawn(
862
- command: string,
863
- args: readonly string[],
864
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
865
- ): ChildProcessByStdio<null, Readable, Readable>;
866
- function spawn(
867
- command: string,
868
- args: readonly string[],
869
- options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
870
- ): ChildProcessByStdio<Writable, null, null>;
871
- function spawn(
872
- command: string,
873
- args: readonly string[],
874
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
875
- ): ChildProcessByStdio<null, Readable, null>;
876
- function spawn(
877
- command: string,
878
- args: readonly string[],
879
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
880
- ): ChildProcessByStdio<null, null, Readable>;
881
- function spawn(
882
- command: string,
883
- args: readonly string[],
884
- options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
885
- ): ChildProcessByStdio<null, null, null>;
886
- function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
887
- interface ExecOptions extends CommonOptions {
888
- shell?: string | undefined;
889
- signal?: AbortSignal | undefined;
890
- maxBuffer?: number | undefined;
891
- killSignal?: NodeJS.Signals | number | undefined;
892
- }
893
- interface ExecOptionsWithStringEncoding extends ExecOptions {
894
- encoding: BufferEncoding;
895
- }
896
- interface ExecOptionsWithBufferEncoding extends ExecOptions {
897
- encoding: BufferEncoding | null; // specify `null`.
898
- }
899
- interface ExecException extends Error {
900
- cmd?: string | undefined;
901
- killed?: boolean | undefined;
902
- code?: number | undefined;
903
- signal?: NodeJS.Signals | undefined;
904
- }
905
- /**
906
- * Spawns a shell then executes the `command` within that shell, buffering any
907
- * generated output. The `command` string passed to the exec function is processed
908
- * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
909
- * need to be dealt with accordingly:
910
- *
911
- * ```js
912
- * import { exec } from 'node:child_process';
913
- *
914
- * exec('"/path/to/test file/test.sh" arg1 arg2');
915
- * // Double quotes are used so that the space in the path is not interpreted as
916
- * // a delimiter of multiple arguments.
917
- *
918
- * exec('echo "The \\$HOME variable is $HOME"');
919
- * // The $HOME variable is escaped in the first instance, but not in the second.
920
- * ```
921
- *
922
- * **Never pass unsanitized user input to this function. Any input containing shell**
923
- * **metacharacters may be used to trigger arbitrary command execution.**
924
- *
925
- * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The
926
- * `error.code` property will be
927
- * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the
928
- * process.
929
- *
930
- * The `stdout` and `stderr` arguments passed to the callback will contain the
931
- * stdout and stderr output of the child process. By default, Node.js will decode
932
- * the output as UTF-8 and pass strings to the callback. The `encoding` option
933
- * can be used to specify the character encoding used to decode the stdout and
934
- * stderr output. If `encoding` is `'buffer'`, or an unrecognized character
935
- * encoding, `Buffer` objects will be passed to the callback instead.
936
- *
937
- * ```js
938
- * import { exec } from 'node:child_process';
939
- * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
940
- * if (error) {
941
- * console.error(`exec error: ${error}`);
942
- * return;
943
- * }
944
- * console.log(`stdout: ${stdout}`);
945
- * console.error(`stderr: ${stderr}`);
946
- * });
947
- * ```
948
- *
949
- * If `timeout` is greater than `0`, the parent will send the signal
950
- * identified by the `killSignal` property (the default is `'SIGTERM'`) if the
951
- * child runs longer than `timeout` milliseconds.
952
- *
953
- * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace
954
- * the existing process and uses a shell to execute the command.
955
- *
956
- * If this method is invoked as its `util.promisify()` ed version, it returns
957
- * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
958
- * case of an error (including any error resulting in an exit code other than 0), a
959
- * rejected promise is returned, with the same `error` object given in the
960
- * callback, but with two additional properties `stdout` and `stderr`.
961
- *
962
- * ```js
963
- * import util from 'node:util';
964
- * import child_process from 'node:child_process';
965
- * const exec = util.promisify(child_process.exec);
966
- *
967
- * async function lsExample() {
968
- * const { stdout, stderr } = await exec('ls');
969
- * console.log('stdout:', stdout);
970
- * console.error('stderr:', stderr);
971
- * }
972
- * lsExample();
973
- * ```
974
- *
975
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
976
- * the error passed to the callback will be an `AbortError`:
977
- *
978
- * ```js
979
- * import { exec } from 'node:child_process';
980
- * const controller = new AbortController();
981
- * const { signal } = controller;
982
- * const child = exec('grep ssh', { signal }, (error) => {
983
- * console.log(error); // an AbortError
984
- * });
985
- * controller.abort();
986
- * ```
987
- * @since v0.1.90
988
- * @param command The command to run, with space-separated arguments.
989
- * @param callback called with the output when process terminates.
990
- */
991
- function exec(
992
- command: string,
993
- callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
994
- ): ChildProcess;
995
- // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
996
- function exec(
997
- command: string,
998
- options: {
999
- encoding: "buffer" | null;
1000
- } & ExecOptions,
1001
- callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
1002
- ): ChildProcess;
1003
- // `options` with well known `encoding` means stdout/stderr are definitely `string`.
1004
- function exec(
1005
- command: string,
1006
- options: {
1007
- encoding: BufferEncoding;
1008
- } & ExecOptions,
1009
- callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
1010
- ): ChildProcess;
1011
- // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
1012
- // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
1013
- function exec(
1014
- command: string,
1015
- options: {
1016
- encoding: BufferEncoding;
1017
- } & ExecOptions,
1018
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1019
- ): ChildProcess;
1020
- // `options` without an `encoding` means stdout/stderr are definitely `string`.
1021
- function exec(
1022
- command: string,
1023
- options: ExecOptions,
1024
- callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
1025
- ): ChildProcess;
1026
- // fallback if nothing else matches. Worst case is always `string | Buffer`.
1027
- function exec(
1028
- command: string,
1029
- options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
1030
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1031
- ): ChildProcess;
1032
- interface PromiseWithChild<T> extends Promise<T> {
1033
- child: ChildProcess;
1034
- }
1035
- namespace exec {
1036
- function __promisify__(command: string): PromiseWithChild<{
1037
- stdout: string;
1038
- stderr: string;
1039
- }>;
1040
- function __promisify__(
1041
- command: string,
1042
- options: {
1043
- encoding: "buffer" | null;
1044
- } & ExecOptions,
1045
- ): PromiseWithChild<{
1046
- stdout: Buffer;
1047
- stderr: Buffer;
1048
- }>;
1049
- function __promisify__(
1050
- command: string,
1051
- options: {
1052
- encoding: BufferEncoding;
1053
- } & ExecOptions,
1054
- ): PromiseWithChild<{
1055
- stdout: string;
1056
- stderr: string;
1057
- }>;
1058
- function __promisify__(
1059
- command: string,
1060
- options: ExecOptions,
1061
- ): PromiseWithChild<{
1062
- stdout: string;
1063
- stderr: string;
1064
- }>;
1065
- function __promisify__(
1066
- command: string,
1067
- options?: (ObjectEncodingOptions & ExecOptions) | null,
1068
- ): PromiseWithChild<{
1069
- stdout: string | Buffer;
1070
- stderr: string | Buffer;
1071
- }>;
1072
- }
1073
- interface ExecFileOptions extends CommonOptions, Abortable {
1074
- maxBuffer?: number | undefined;
1075
- killSignal?: NodeJS.Signals | number | undefined;
1076
- windowsVerbatimArguments?: boolean | undefined;
1077
- shell?: boolean | string | undefined;
1078
- signal?: AbortSignal | undefined;
1079
- }
1080
- interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
1081
- encoding: BufferEncoding;
1082
- }
1083
- interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
1084
- encoding: "buffer" | null;
1085
- }
1086
- interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
1087
- encoding: BufferEncoding;
1088
- }
1089
- type ExecFileException =
1090
- & Omit<ExecException, "code">
1091
- & Omit<NodeJS.ErrnoException, "code">
1092
- & { code?: string | number | undefined | null };
1093
- /**
1094
- * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
1095
- * executable `file` is spawned directly as a new process making it slightly more
1096
- * efficient than {@link exec}.
1097
- *
1098
- * The same options as {@link exec} are supported. Since a shell is
1099
- * not spawned, behaviors such as I/O redirection and file globbing are not
1100
- * supported.
1101
- *
1102
- * ```js
1103
- * import { execFile } from 'node:child_process';
1104
- * const child = execFile('node', ['--version'], (error, stdout, stderr) => {
1105
- * if (error) {
1106
- * throw error;
1107
- * }
1108
- * console.log(stdout);
1109
- * });
1110
- * ```
1111
- *
1112
- * The `stdout` and `stderr` arguments passed to the callback will contain the
1113
- * stdout and stderr output of the child process. By default, Node.js will decode
1114
- * the output as UTF-8 and pass strings to the callback. The `encoding` option
1115
- * can be used to specify the character encoding used to decode the stdout and
1116
- * stderr output. If `encoding` is `'buffer'`, or an unrecognized character
1117
- * encoding, `Buffer` objects will be passed to the callback instead.
1118
- *
1119
- * If this method is invoked as its `util.promisify()` ed version, it returns
1120
- * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
1121
- * case of an error (including any error resulting in an exit code other than 0), a
1122
- * rejected promise is returned, with the same `error` object given in the
1123
- * callback, but with two additional properties `stdout` and `stderr`.
1124
- *
1125
- * ```js
1126
- * import util from 'node:util';
1127
- * import child_process from 'node:child_process';
1128
- * const execFile = util.promisify(child_process.execFile);
1129
- * async function getVersion() {
1130
- * const { stdout } = await execFile('node', ['--version']);
1131
- * console.log(stdout);
1132
- * }
1133
- * getVersion();
1134
- * ```
1135
- *
1136
- * **If the `shell` option is enabled, do not pass unsanitized user input to this**
1137
- * **function. Any input containing shell metacharacters may be used to trigger**
1138
- * **arbitrary command execution.**
1139
- *
1140
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
1141
- * the error passed to the callback will be an `AbortError`:
1142
- *
1143
- * ```js
1144
- * import { execFile } from 'node:child_process';
1145
- * const controller = new AbortController();
1146
- * const { signal } = controller;
1147
- * const child = execFile('node', ['--version'], { signal }, (error) => {
1148
- * console.log(error); // an AbortError
1149
- * });
1150
- * controller.abort();
1151
- * ```
1152
- * @since v0.1.91
1153
- * @param file The name or path of the executable file to run.
1154
- * @param args List of string arguments.
1155
- * @param callback Called with the output when process terminates.
1156
- */
1157
- function execFile(file: string): ChildProcess;
1158
- function execFile(
1159
- file: string,
1160
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1161
- ): ChildProcess;
1162
- function execFile(file: string, args?: readonly string[] | null): ChildProcess;
1163
- function execFile(
1164
- file: string,
1165
- args: readonly string[] | undefined | null,
1166
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1167
- ): ChildProcess;
1168
- // no `options` definitely means stdout/stderr are `string`.
1169
- function execFile(
1170
- file: string,
1171
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1172
- ): ChildProcess;
1173
- function execFile(
1174
- file: string,
1175
- args: readonly string[] | undefined | null,
1176
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1177
- ): ChildProcess;
1178
- // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
1179
- function execFile(
1180
- file: string,
1181
- options: ExecFileOptionsWithBufferEncoding,
1182
- callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1183
- ): ChildProcess;
1184
- function execFile(
1185
- file: string,
1186
- args: readonly string[] | undefined | null,
1187
- options: ExecFileOptionsWithBufferEncoding,
1188
- callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1189
- ): ChildProcess;
1190
- // `options` with well known `encoding` means stdout/stderr are definitely `string`.
1191
- function execFile(
1192
- file: string,
1193
- options: ExecFileOptionsWithStringEncoding,
1194
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1195
- ): ChildProcess;
1196
- function execFile(
1197
- file: string,
1198
- args: readonly string[] | undefined | null,
1199
- options: ExecFileOptionsWithStringEncoding,
1200
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1201
- ): ChildProcess;
1202
- // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
1203
- // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
1204
- function execFile(
1205
- file: string,
1206
- options: ExecFileOptionsWithOtherEncoding,
1207
- callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1208
- ): ChildProcess;
1209
- function execFile(
1210
- file: string,
1211
- args: readonly string[] | undefined | null,
1212
- options: ExecFileOptionsWithOtherEncoding,
1213
- callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1214
- ): ChildProcess;
1215
- // `options` without an `encoding` means stdout/stderr are definitely `string`.
1216
- function execFile(
1217
- file: string,
1218
- options: ExecFileOptions,
1219
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1220
- ): ChildProcess;
1221
- function execFile(
1222
- file: string,
1223
- args: readonly string[] | undefined | null,
1224
- options: ExecFileOptions,
1225
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
1226
- ): ChildProcess;
1227
- // fallback if nothing else matches. Worst case is always `string | Buffer`.
1228
- function execFile(
1229
- file: string,
1230
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1231
- callback:
1232
- | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1233
- | undefined
1234
- | null,
1235
- ): ChildProcess;
1236
- function execFile(
1237
- file: string,
1238
- args: readonly string[] | undefined | null,
1239
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1240
- callback:
1241
- | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1242
- | undefined
1243
- | null,
1244
- ): ChildProcess;
1245
- namespace execFile {
1246
- function __promisify__(file: string): PromiseWithChild<{
1247
- stdout: string;
1248
- stderr: string;
1249
- }>;
1250
- function __promisify__(
1251
- file: string,
1252
- args: readonly string[] | undefined | null,
1253
- ): PromiseWithChild<{
1254
- stdout: string;
1255
- stderr: string;
1256
- }>;
1257
- function __promisify__(
1258
- file: string,
1259
- options: ExecFileOptionsWithBufferEncoding,
1260
- ): PromiseWithChild<{
1261
- stdout: Buffer;
1262
- stderr: Buffer;
1263
- }>;
1264
- function __promisify__(
1265
- file: string,
1266
- args: readonly string[] | undefined | null,
1267
- options: ExecFileOptionsWithBufferEncoding,
1268
- ): PromiseWithChild<{
1269
- stdout: Buffer;
1270
- stderr: Buffer;
1271
- }>;
1272
- function __promisify__(
1273
- file: string,
1274
- options: ExecFileOptionsWithStringEncoding,
1275
- ): PromiseWithChild<{
1276
- stdout: string;
1277
- stderr: string;
1278
- }>;
1279
- function __promisify__(
1280
- file: string,
1281
- args: readonly string[] | undefined | null,
1282
- options: ExecFileOptionsWithStringEncoding,
1283
- ): PromiseWithChild<{
1284
- stdout: string;
1285
- stderr: string;
1286
- }>;
1287
- function __promisify__(
1288
- file: string,
1289
- options: ExecFileOptionsWithOtherEncoding,
1290
- ): PromiseWithChild<{
1291
- stdout: string | Buffer;
1292
- stderr: string | Buffer;
1293
- }>;
1294
- function __promisify__(
1295
- file: string,
1296
- args: readonly string[] | undefined | null,
1297
- options: ExecFileOptionsWithOtherEncoding,
1298
- ): PromiseWithChild<{
1299
- stdout: string | Buffer;
1300
- stderr: string | Buffer;
1301
- }>;
1302
- function __promisify__(
1303
- file: string,
1304
- options: ExecFileOptions,
1305
- ): PromiseWithChild<{
1306
- stdout: string;
1307
- stderr: string;
1308
- }>;
1309
- function __promisify__(
1310
- file: string,
1311
- args: readonly string[] | undefined | null,
1312
- options: ExecFileOptions,
1313
- ): PromiseWithChild<{
1314
- stdout: string;
1315
- stderr: string;
1316
- }>;
1317
- function __promisify__(
1318
- file: string,
1319
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1320
- ): PromiseWithChild<{
1321
- stdout: string | Buffer;
1322
- stderr: string | Buffer;
1323
- }>;
1324
- function __promisify__(
1325
- file: string,
1326
- args: readonly string[] | undefined | null,
1327
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
1328
- ): PromiseWithChild<{
1329
- stdout: string | Buffer;
1330
- stderr: string | Buffer;
1331
- }>;
1332
- }
1333
- interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
1334
- execPath?: string | undefined;
1335
- execArgv?: string[] | undefined;
1336
- silent?: boolean | undefined;
1337
- /**
1338
- * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
1339
- * If passed as an array, the first element is used for `stdin`, the second for
1340
- * `stdout`, and the third for `stderr`. A fourth element can be used to
1341
- * specify the `stdio` behavior beyond the standard streams. See
1342
- * {@link ChildProcess.stdio} for more information.
1343
- *
1344
- * @default 'pipe'
1345
- */
1346
- stdio?: StdioOptions | undefined;
1347
- detached?: boolean | undefined;
1348
- windowsVerbatimArguments?: boolean | undefined;
1349
- }
1350
- /**
1351
- * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes.
1352
- * Like {@link spawn}, a `ChildProcess` object is returned. The
1353
- * returned `ChildProcess` will have an additional communication channel
1354
- * built-in that allows messages to be passed back and forth between the parent and
1355
- * child. See `subprocess.send()` for details.
1356
- *
1357
- * Keep in mind that spawned Node.js child processes are
1358
- * independent of the parent with exception of the IPC communication channel
1359
- * that is established between the two. Each process has its own memory, with
1360
- * their own V8 instances. Because of the additional resource allocations
1361
- * required, spawning a large number of child Node.js processes is not
1362
- * recommended.
1363
- *
1364
- * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative
1365
- * execution path to be used.
1366
- *
1367
- * Node.js processes launched with a custom `execPath` will communicate with the
1368
- * parent process using the file descriptor (fd) identified using the
1369
- * environment variable `NODE_CHANNEL_FD` on the child process.
1370
- *
1371
- * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
1372
- * current process.
1373
- *
1374
- * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set.
1375
- *
1376
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
1377
- * the error passed to the callback will be an `AbortError`:
1378
- *
1379
- * ```js
1380
- * import { fork } from 'node:child_process';
1381
- * if (process.argv[2] === 'child') {
1382
- * setTimeout(() => {
1383
- * console.log(`Hello from ${process.argv[2]}!`);
1384
- * }, 1_000);
1385
- * } else {
1386
- * const controller = new AbortController();
1387
- * const { signal } = controller;
1388
- * const child = fork(__filename, ['child'], { signal });
1389
- * child.on('error', (err) => {
1390
- * // This will be called with err being an AbortError if the controller aborts
1391
- * });
1392
- * controller.abort(); // Stops the child process
1393
- * }
1394
- * ```
1395
- * @since v0.5.0
1396
- * @param modulePath The module to run in the child.
1397
- * @param args List of string arguments.
1398
- */
1399
- function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
1400
- function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
1401
- interface SpawnSyncOptions extends CommonSpawnOptions {
1402
- input?: string | NodeJS.ArrayBufferView | undefined;
1403
- maxBuffer?: number | undefined;
1404
- encoding?: BufferEncoding | "buffer" | null | undefined;
1405
- }
1406
- interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
1407
- encoding: BufferEncoding;
1408
- }
1409
- interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
1410
- encoding?: "buffer" | null | undefined;
1411
- }
1412
- interface SpawnSyncReturns<T> {
1413
- pid: number;
1414
- output: Array<T | null>;
1415
- stdout: T;
1416
- stderr: T;
1417
- status: number | null;
1418
- signal: NodeJS.Signals | null;
1419
- error?: Error | undefined;
1420
- }
1421
- /**
1422
- * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
1423
- * until the child process has fully closed. When a timeout has been encountered
1424
- * and `killSignal` is sent, the method won't return until the process has
1425
- * completely exited. If the process intercepts and handles the `SIGTERM` signal
1426
- * and doesn't exit, the parent process will wait until the child process has
1427
- * exited.
1428
- *
1429
- * **If the `shell` option is enabled, do not pass unsanitized user input to this**
1430
- * **function. Any input containing shell metacharacters may be used to trigger**
1431
- * **arbitrary command execution.**
1432
- * @since v0.11.12
1433
- * @param command The command to run.
1434
- * @param args List of string arguments.
1435
- */
1436
- function spawnSync(command: string): SpawnSyncReturns<Buffer>;
1437
- function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
1438
- function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
1439
- function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
1440
- function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
1441
- function spawnSync(
1442
- command: string,
1443
- args: readonly string[],
1444
- options: SpawnSyncOptionsWithStringEncoding,
1445
- ): SpawnSyncReturns<string>;
1446
- function spawnSync(
1447
- command: string,
1448
- args: readonly string[],
1449
- options: SpawnSyncOptionsWithBufferEncoding,
1450
- ): SpawnSyncReturns<Buffer>;
1451
- function spawnSync(
1452
- command: string,
1453
- args?: readonly string[],
1454
- options?: SpawnSyncOptions,
1455
- ): SpawnSyncReturns<string | Buffer>;
1456
- interface CommonExecOptions extends CommonOptions {
1457
- input?: string | NodeJS.ArrayBufferView | undefined;
1458
- /**
1459
- * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
1460
- * If passed as an array, the first element is used for `stdin`, the second for
1461
- * `stdout`, and the third for `stderr`. A fourth element can be used to
1462
- * specify the `stdio` behavior beyond the standard streams. See
1463
- * {@link ChildProcess.stdio} for more information.
1464
- *
1465
- * @default 'pipe'
1466
- */
1467
- stdio?: StdioOptions | undefined;
1468
- killSignal?: NodeJS.Signals | number | undefined;
1469
- maxBuffer?: number | undefined;
1470
- encoding?: BufferEncoding | "buffer" | null | undefined;
1471
- }
1472
- interface ExecSyncOptions extends CommonExecOptions {
1473
- shell?: string | undefined;
1474
- }
1475
- interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
1476
- encoding: BufferEncoding;
1477
- }
1478
- interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
1479
- encoding?: "buffer" | null | undefined;
1480
- }
1481
- /**
1482
- * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
1483
- * until the child process has fully closed. When a timeout has been encountered
1484
- * and `killSignal` is sent, the method won't return until the process has
1485
- * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process
1486
- * has exited.
1487
- *
1488
- * If the process times out or has a non-zero exit code, this method will throw.
1489
- * The `Error` object will contain the entire result from {@link spawnSync}.
1490
- *
1491
- * **Never pass unsanitized user input to this function. Any input containing shell**
1492
- * **metacharacters may be used to trigger arbitrary command execution.**
1493
- * @since v0.11.12
1494
- * @param command The command to run.
1495
- * @return The stdout from the command.
1496
- */
1497
- function execSync(command: string): Buffer;
1498
- function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
1499
- function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
1500
- function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
1501
- interface ExecFileSyncOptions extends CommonExecOptions {
1502
- shell?: boolean | string | undefined;
1503
- }
1504
- interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
1505
- encoding: BufferEncoding;
1506
- }
1507
- interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
1508
- encoding?: "buffer" | null; // specify `null`.
1509
- }
1510
- /**
1511
- * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
1512
- * return until the child process has fully closed. When a timeout has been
1513
- * encountered and `killSignal` is sent, the method won't return until the process
1514
- * has completely exited.
1515
- *
1516
- * If the child process intercepts and handles the `SIGTERM` signal and
1517
- * does not exit, the parent process will still wait until the child process has
1518
- * exited.
1519
- *
1520
- * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}.
1521
- *
1522
- * **If the `shell` option is enabled, do not pass unsanitized user input to this**
1523
- * **function. Any input containing shell metacharacters may be used to trigger**
1524
- * **arbitrary command execution.**
1525
- * @since v0.11.12
1526
- * @param file The name or path of the executable file to run.
1527
- * @param args List of string arguments.
1528
- * @return The stdout from the command.
1529
- */
1530
- function execFileSync(file: string): Buffer;
1531
- function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
1532
- function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
1533
- function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
1534
- function execFileSync(file: string, args: readonly string[]): Buffer;
1535
- function execFileSync(
1536
- file: string,
1537
- args: readonly string[],
1538
- options: ExecFileSyncOptionsWithStringEncoding,
1539
- ): string;
1540
- function execFileSync(
1541
- file: string,
1542
- args: readonly string[],
1543
- options: ExecFileSyncOptionsWithBufferEncoding,
1544
- ): Buffer;
1545
- function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
1546
- }
1547
- declare module "node:child_process" {
1548
- export * from "child_process";
1549
- }