Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and type more subprocess.* properties/methods #968

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Apr 9, 2024

This PR adds better documentation and types for subprocess.stdin, subprocess.stdout, subprocess.stderr, subprocess.stdio, subprocess.all, subprocess.send(), subprocess.on('message') and subprocess.pid.

This intentionally leaves out the following subprocess.* properties/methods:

  • subprocess.channel: advanced feature, not very useful (?)
  • subprocess.connected, subprocess.disconnect(): IPC features which will be superseded by our upcoming IPC helper (IPC helper #900)
  • subprocess.exitCode: users should use result.exitCode instead
  • subprocess.signalCode: users should use result.signal instead
  • subprocess[Symbol.dispose]: terminating processes with a signal is not graceful, and we should not promote it
  • subprocess.killed: confusing property which does not mean what people think it does. It just means subprocess.kill() has been called, successfully or not, and with any signal (including non-termination signals). It is just meant for idempotency, i.e. is not very useful since subprocess.kill() is already idempotent.
  • subprocess.unref() and subprocess.ref(): arguably useful in some edge cases? Left out for the moment, but I'm happy to document it if you think we should.
  • subprocess.spawnargs, subprocess.spawnfile: can be useful for debugging, but maybe not that much. I have personally never used it, despite the thousands of tests on Execa that required some levels of debugging.

A link to the official Node.js documentation is still left, since those are still available (and typed).


The subprocess [`stdin`](#optionsstdin) as a stream.

This is `null` if the [`stdin`](#optionsstdin) option is set to `'inherit'`, `'ignore'`, `Readable` or `integer`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but would be nice to make this undefined instead of null.

@sindresorhus sindresorhus merged commit fe330a9 into main Apr 9, 2024
12 checks passed
@sindresorhus sindresorhus deleted the document-stream branch April 9, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants