diff options
author | 2023-09-07 10:09:09 -0700 | |
---|---|---|
committer | 2023-09-07 10:09:09 -0700 | |
commit | 5424ea3403df9cd4672290865f12b6f5b01cf2d0 (patch) | |
tree | 27e19a70fba49ffdd944c190163f5e8322d7a32f /docs/api/spawn.md | |
parent | 4b63ced72dc1b304e737d9ea055c8b6e75f46119 (diff) | |
download | bun-5424ea3403df9cd4672290865f12b6f5b01cf2d0.tar.gz bun-5424ea3403df9cd4672290865f12b6f5b01cf2d0.tar.zst bun-5424ea3403df9cd4672290865f12b6f5b01cf2d0.zip |
Doc updates for v1.0 (#4485)
* Remove v0.x messages
* Add windows section to Installatino
* update
* update
* Update
* Comment out windows
Diffstat (limited to 'docs/api/spawn.md')
-rw-r--r-- | docs/api/spawn.md | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/docs/api/spawn.md b/docs/api/spawn.md index b040272b5..a85f9d08c 100644 --- a/docs/api/spawn.md +++ b/docs/api/spawn.md @@ -28,7 +28,9 @@ By default, the input stream of the subprocess is undefined; it can be configure ```ts const proc = Bun.spawn(["cat"], { - stdin: await fetch("https://raw.githubusercontent.com/oven-sh/bun/main/examples/hashing.js"), + stdin: await fetch( + "https://raw.githubusercontent.com/oven-sh/bun/main/examples/hashing.js", + ), }); const text = await new Response(proc.stdout).text(); @@ -209,7 +211,7 @@ Bun's `spawnSync` spawns processes 60% faster than the Node.js `child_process` m ```bash $ bun spawn.mjs cpu: Apple M1 Max -runtime: bun 0.2.0 (arm64-darwin) +runtime: bun 1.x (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p995 --------------------------------------------------------- ----------------------------- @@ -230,10 +232,15 @@ A simple reference of the Spawn API and types are shown below. The real types ha ```ts interface Bun { spawn(command: string[], options?: SpawnOptions.OptionsObject): Subprocess; - spawnSync(command: string[], options?: SpawnOptions.OptionsObject): SyncSubprocess; + spawnSync( + command: string[], + options?: SpawnOptions.OptionsObject, + ): SyncSubprocess; spawn(options: { cmd: string[] } & SpawnOptions.OptionsObject): Subprocess; - spawnSync(options: { cmd: string[] } & SpawnOptions.OptionsObject): SyncSubprocess; + spawnSync( + options: { cmd: string[] } & SpawnOptions.OptionsObject, + ): SyncSubprocess; } namespace SpawnOptions { @@ -243,7 +250,12 @@ namespace SpawnOptions { stdin?: SpawnOptions.Readable; stdout?: SpawnOptions.Writable; stderr?: SpawnOptions.Writable; - onExit?: (proc: Subprocess, exitCode: number | null, signalCode: string | null, error: Error | null) => void; + onExit?: ( + proc: Subprocess, + exitCode: number | null, + signalCode: string | null, + error: Error | null, + ) => void; } type Readable = |