mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
io: Explicitly reset discard flag
When we discard output because there's been too much, we print a warning, but subsequent uses of the same buffer still discard. Now we explicitly reset the flag, so we warn once and everything works normal after. Fixes #5267.
This commit is contained in:
9
src/io.h
9
src/io.h
@@ -101,6 +101,10 @@ class separated_buffer_t {
|
||||
discard = true;
|
||||
}
|
||||
|
||||
void reset_discard() {
|
||||
discard = false;
|
||||
}
|
||||
|
||||
/// Serialize the contents to a single string, where explicitly separated elements have a
|
||||
/// newline appended.
|
||||
StringType newline_serialized() const {
|
||||
@@ -228,7 +232,10 @@ class io_buffer_t : public io_pipe_t {
|
||||
|
||||
explicit io_buffer_t(int f, size_t limit)
|
||||
: io_pipe_t(IO_BUFFER, f, false /* not input */),
|
||||
buffer_(limit) {}
|
||||
buffer_(limit) {
|
||||
// Explicitly reset the discard flag because we share this buffer.
|
||||
buffer_.reset_discard();
|
||||
}
|
||||
|
||||
public:
|
||||
void print() const override;
|
||||
|
||||
Reference in New Issue
Block a user