windows.md
This file
Path
docs/windows.md
57 lines · 3.2 KiB · Markdown
Last changed by
Document `SIGQUIT` (#1022)ehmickybefore adoptionc5bd9d8
History of this fileTake it
Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 1–28why, one step back1<picture>2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 📎 Windows89Although each OS implements subprocesses very differently, Execa makes them cross-platform, except in a few instances.1011## Shebang1213On Unix, executable files can use [shebangs](https://en.wikipedia.org/wiki/Shebang_(Unix)).1415```js16import {execa} from 'execa';1718// If script.js starts with #!/usr/bin/env node19await execa`./script.js`;2021// Then, the above is a shortcut for:22await execa`node ./script.js`;23```2425Although Windows does not natively support shebangs, Execa adds support for them.2627## Signals28Document `SIGQUIT` (#1022)ehmickybefore adoptionc5bd9d8
line 29why, one step back29Only few [signals](termination.md#other-signals) work on Windows with Node.js: [`SIGTERM`](termination.md#sigterm), [`SIGKILL`](termination.md#sigkill), [`SIGINT`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGINT) and [`SIGQUIT`](termination.md#sigquit). Also, sending signals from other processes is [not supported](termination.md#signal-name-and-description). Finally, the [`forceKillAfterDelay`](api.md#optionsforcekillafterdelay) option [is a noop](termination.md#forceful-termination) on Windows.Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 30–32why, one step back3031## Asynchronous I/O32Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 33why, one step back33The default value for the [`stdin`](api.md#optionsstdin), [`stdout`](api.md#optionsstdout) and [`stderr`](api.md#optionsstderr) options is [`'pipe'`](output.md#stdout-and-stderr). This returns the output as [`result.stdout`](api.md#resultstdout) and [`result.stderr`](api.md#resultstderr) and allows for [manual streaming](streams.md#manual-streaming).Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 34–38why, one step back3435Instead of `'pipe'`, `'overlapped'` can be used instead to use [asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o) under-the-hood on Windows, instead of the default behavior which is synchronous. On other platforms, asynchronous I/O is always used, so `'overlapped'` behaves the same way as `'pipe'`.3637## `cmd.exe` escaping38Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 39why, one step back39If the [`windowsVerbatimArguments`](api.md#optionswindowsverbatimarguments) option is `false`, the [command arguments](input.md#command-arguments) are automatically escaped on Windows. When using a [`cmd.exe`](https://en.wikipedia.org/wiki/Cmd.exe) [shell](api.md#optionsshell), this is `true` by default instead.Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 40–44why, one step back4041This is ignored on other platforms: those are [automatically escaped](escaping.md) by default.4243## Console window44Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 45why, one step back45If the [`windowsHide`](api.md#optionswindowshide) option is `false`, the subprocess is run in a new console window. This is necessary to make [`SIGINT` work](https://github.com/nodejs/node/issues/29837) on Windows, and to prevent subprocesses not being cleaned up in [some specific situations](https://github.com/sindresorhus/execa/issues/433).Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 46–48why, one step back4647## UID and GID48Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 49why, one step back49By default, subprocesses are run using the current [user](https://en.wikipedia.org/wiki/User_identifier) and [group](https://en.wikipedia.org/wiki/Group_identifier). The [`uid`](api.md#optionsuid) and [`gid`](api.md#optionsgid) options can be used to set a different user or group.Add user guides (#989)ehmickybefore adoptionbe91ecf
lines 50–57why, one step back5051However, since Windows uses a different permission model, those options throw.5253<hr>5455[**Next**: 🔍 Differences with Bash and zx](bash.md)\56[**Previous**: 🐛 Debugging](debugging.md)\57[**Top**: Table of contents](../readme.md#documentation)