mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 07:02:46 +08:00
Clean up a few bits about discarding buffers
We weren't properly propagating the 'discarded' stuff from output streams to buffers. Fix that.
This commit is contained in:
parent
b99546e7a0
commit
4f205f38b4
|
@ -48,7 +48,7 @@ void io_bufferfill_t::print() const { std::fwprintf(stderr, L"bufferfill {%d}\n"
|
|||
|
||||
void io_buffer_t::append_from_stream(const output_stream_t &stream) {
|
||||
const separated_buffer_t<wcstring> &input = stream.buffer();
|
||||
if (input.elements().empty()) return;
|
||||
if (input.elements().empty() && !input.discarded()) return;
|
||||
scoped_lock locker(append_lock_);
|
||||
if (buffer_.discarded()) return;
|
||||
if (input.discarded()) {
|
||||
|
|
7
src/io.h
7
src/io.h
|
@ -117,8 +117,6 @@ 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 {
|
||||
|
@ -322,10 +320,7 @@ class io_buffer_t {
|
|||
bool fillthread_running() const { return fillthread_waiter_.valid(); }
|
||||
|
||||
public:
|
||||
explicit io_buffer_t(size_t limit) : buffer_(limit) {
|
||||
// Explicitly reset the discard flag because we share this buffer.
|
||||
buffer_.reset_discard();
|
||||
}
|
||||
explicit io_buffer_t(size_t limit) : buffer_(limit) {}
|
||||
|
||||
~io_buffer_t();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user