sindresorhus

nano-spawn

Tiny process execution for humans — a better child_process

by sindresorhus

JavaScript

JavaScript92.7%
TypeScript7.3%

Commit activity

Last 12 weeks · 1 commit

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 4 discussions · Last activity 1mo ago
See all on GitHub →
YevheniiKotyrlo

On Windows, nano-spawn escapes every argument to a or file twice, so that a batch file that passes them on, like a shim, still gets special characters through (#38). A batch file that reads an argument itself sees the second layer of escaping instead. The launchers Gradle generates for Java programs read their first argument with , so they fail on any argument: Those are the Android SDK's and , which an open React Native Harness PR runs through nano-spawn to support Windows (callstackincubator/react-native-harness#192). I have a fix with tests on my fork, since pull requests here are open to collaborators only: https://github.com/sindresorhus/nano-spawn/compare/main...YevheniiKotyrlo:nano-spawn:fix/escape-batch-arguments-once. An argument without special characters needs no escaping, so it is passed as is, or only quoted when it is empty or holds whitespace, which every batch file reads correctly; an argument with special characters is escaped twice as before, so #38's cases are unchanged. A batch file that reads a first argument containing special characters still fails, since no single escaping serves both kinds of batch file there. reproduces the launcher's header, and the new tests pass a plain argument, one with , one with a space and one ending in through it; on they fail with the errors above. On Windows 11 the full suite passes on the branch apart from three cases that fail on too on that machine: they run Node with , and its path there, under , holds a space. With the change, the and calls above and with on stdin exit 0.

YevheniiKotyrlo · 2d ago
fisker

Month ago, When I switch to I got I thought it's bug, so I switched to . but I just found that I should use as stdin. Is it possible to improve the error? Or maybe use instead?

fisker · 11mo ago
davidnichols-ops

Fixes #112. Arbitrary strings passed to are now used directly as subprocess input. The four Node.js stdio modes (, , , and ) keep their existing behavior, and the existing form remains supported. The implementation only applies this shorthand to the top-level option, so , , and continue to follow Node.js semantics. Includes runtime tests for arbitrary and empty strings, the commonly mistyped value, the correct mode, TypeScript coverage, and documentation updates.

davidnichols-ops · 2mo ago
ehmicky

This adds , which is always set as a boolean, and is when a has been canceled by the option. This PR makes sure is if the subprocess is terminated by an unrelated to the option, e.g. if one of the streams emits an event due to an .

ehmicky · 6mo ago
chrismwendt

This change preserves so that callers can check if to know if a subprocess got cancelled or if it encountered some other error. Maintaining the error identity helps callers distinguish between the two.

chrismwendt · 6mo ago
Structured data for AI agents

Repository: sindresorhus/nano-spawn. Description: Tiny process execution for humans — a better child_process Stars: 592, Forks: 16. Primary language: JavaScript. Languages: JavaScript (92.7%), TypeScript (7.3%). License: MIT. Latest release: v2.1.0 (6mo ago). Open PRs: 0, open issues: 4. Last activity: 1mo ago. Community health: 85%. Top contributors: ehmicky, sindresorhus, fisker, Septh.