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

Add exec/2: posix_spawn #3133

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions docs/content/manual/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3271,6 +3271,13 @@ sections:
builtin outputs its input in raw mode to stder with no additional
decoration, not even a newline.

Additionally, jq has support for executing "external filters" provided by
other executables. This functionality is provided by `exec` and related
filters viz. `system`, but may not be available on all platforms, and does
not necessarily integrate well with other jq features. It is intended to
perform smaller processing that is otherwise impossible to perform in jq
itself.

Most jq builtins are referentially transparent, and yield constant
and repeatable value streams when applied to constant inputs.
This is not true of I/O builtins.
Expand Down Expand Up @@ -3344,6 +3351,23 @@ sections:

Returns the line number of the input currently being filtered.

- title: "`exec(path)`, `exec(path; [args…])`"
body: |

Spawns a new process of path with arguments args. Pipes its input
converted to a string as the stdin of the process. Outputs an object
like `{'out': "", "err": "", "status": 0}`, containing the stdout,
stderr, and exit code of the process respectively. If the process
exits abnormally due to an unhandled signal, it will have a status of
"-1" and a "signal" parameter giving the numeric value of the signal
that caused the process to terminate.

- title: "`system(path)`, `system(path; [args…])`"
body: |

Exactly equivalent to an `exec` call with the same arguments, followed
by `| .out | rtrim`.

- title: 'Streaming'
body: |

Expand Down
9 changes: 9 additions & 0 deletions jq.1.prebuilt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading