mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
Reset the read byte limit to the default when unset
This used to be kept, so e.g. testing it with fish_read_limit=5 echo (string repeat -n 10 a) would cause the prompt and such to error as well. Also there was no good way to get back to the default value afterwards.
This commit is contained in:
parent
eac808a819
commit
b89249de98
2 changed files with 20 additions and 4 deletions
|
@ -56,6 +56,12 @@
|
|||
#include "trace.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
|
||||
// Limit `read` to 100 MiB (bytes not wide chars) by default. This can be overridden by the
|
||||
// fish_read_limit variable.
|
||||
constexpr size_t DEFAULT_READ_BYTE_LIMIT = 100 * 1024 * 1024;
|
||||
size_t read_byte_limit = DEFAULT_READ_BYTE_LIMIT;
|
||||
|
||||
/// List of all locale environment variable names that might trigger (re)initializing the locale
|
||||
/// subsystem. These are only the variables we're possibly interested in.
|
||||
static const wcstring locale_variables[] = {
|
||||
|
@ -299,6 +305,8 @@ static void handle_read_limit_change(const environment_t &vars) {
|
|||
} else {
|
||||
read_byte_limit = limit;
|
||||
}
|
||||
} else {
|
||||
read_byte_limit = DEFAULT_READ_BYTE_LIMIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,7 +679,3 @@ static void init_locale(const environment_t &vars) {
|
|||
|
||||
/// Returns true if we think the terminal supports setting its title.
|
||||
bool term_supports_setting_title() { return can_set_term_title; }
|
||||
|
||||
// Limit `read` to 100 MiB (bytes not wide chars) by default. This can be overridden by the
|
||||
// fish_read_limit variable.
|
||||
size_t read_byte_limit = 100 * 1024 * 1024;
|
||||
|
|
|
@ -72,3 +72,15 @@ or echo expected status 122, saw $saved_status >&2
|
|||
#CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded
|
||||
#CHECKERR: echo this will fail (string repeat --max 513 b) to output anything
|
||||
#CHECKERR: ^
|
||||
|
||||
|
||||
# Check that it's reset to the default when unset
|
||||
begin
|
||||
set -l fish_read_limit 5
|
||||
echo (string repeat -n 10 a)
|
||||
# CHECKERR: {{.*}}cmdsub-limit.fish (line {{\d+}}): Too much data emitted by command substitution so it was discarded
|
||||
# CHECKERR: echo (string repeat -n 10 a)
|
||||
# CHECKERR: ^
|
||||
end
|
||||
echo (string repeat -n 10 a)
|
||||
# CHECK: aaaaaaaaaa
|
||||
|
|
Loading…
Reference in a new issue