document command substitution data limit

This commit is contained in:
Kurtis Rader 2017-08-01 16:46:02 -07:00
parent 4197420f39
commit 2bbcc5cbc8
2 changed files with 4 additions and 2 deletions

View file

@ -470,10 +470,12 @@ end
The output of a series of commands can be used as the parameters to another command. If a parameter contains a set of parenthesis, the text enclosed by the parenthesis will be interpreted as a list of commands. On expansion, this list is executed, and substituted by the output. If the output is more than one line long, each line will be expanded to a new parameter. Setting `IFS` to the empty string will disable line splitting.
The exit status of the last run command substitution is available in the <a href='#variables-status'>status</a> variable.
The exit status of the last run command substitution is available in the <a href='#variables-status'>status</a> variable if the substitution occurs in the context of a `set` command.
Only part of the output can be used, see <a href='#expand-index-range'>index range expansion</a> for details.
Fish has a default limit of 10 MiB on the amount of data a command substitution can output. If the limit is exceeded the entire command, not just the substitution, is failed and `$status` is set to 122. You can modify the limit by setting the `FISH_READ_BYTE_LIMIT` variable at any time including in the environment before fish starts running. This is a safety mechanism to keep the shell from consuming an too much memory if a command outputs an unreasonable amount of data. Note that this limit also affects how much data the `read` command will process.
Examples:
\fish

View file

@ -49,7 +49,7 @@ See the documentation for `set` for more details on the scoping rules for variab
When read reaches the end-of-file (EOF) instead of the separator, it sets `$status` to 1. If not, it sets it to 0.
Fish has a default limit of 10 MiB on the number of characters each `read` will consume. If you attempt to read more than that `$status` is set to 122 and the variable will be empty. You can modify that limit by setting the `FISH_READ_BYTE_LIMIT` variable at any time including in the environment before fish starts running. This is a safety mechanism to keep the shell from consuming an unreasonable amount of memory if the input is malformed.
Fish has a default limit of 10 MiB on the number of characters each `read` will consume. If you attempt to read more than that `$status` is set to 122 and the variable will be empty. You can modify that limit by setting the `FISH_READ_BYTE_LIMIT` variable at any time including in the environment before fish starts running. This is a safety mechanism to keep the shell from consuming an unreasonable amount of memory if the input is malformed. Note that this limit also affects how much data a command substitution is allowed to output.
\subsection read-history Using another read history file