diff options
-rw-r--r-- | exec.cpp | 4 | ||||
-rw-r--r-- | io.cpp | 18 | ||||
-rw-r--r-- | io.h | 10 | ||||
-rw-r--r-- | reader.cpp | 2 |
4 files changed, 17 insertions, 17 deletions
@@ -1008,7 +1008,7 @@ void exec(parser_t &parser, job_t *j) io_remove(j->io, io_buffer); - io_buffer_read(io_buffer.get()); + io_buffer->read(); const char *buffer = io_buffer->out_buffer_ptr(); size_t count = io_buffer->out_buffer_size(); @@ -1423,7 +1423,7 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst) status = proc_get_last_status(); } - io_buffer_read(io_buffer.get()); + io_buffer->read(); proc_set_last_status(prev_status); @@ -81,23 +81,23 @@ void io_buffer_t::print() const fprintf(stderr, "buffer %p (size %lu)\n", out_buffer_ptr(), out_buffer_size()); } -void io_buffer_read(io_buffer_t *d) +void io_buffer_t::read() { - exec_close(d->param1.pipe_fd[1]); + exec_close(param1.pipe_fd[1]); - if (d->io_mode == IO_BUFFER) + if (io_mode == IO_BUFFER) { - /* if( fcntl( d->param1.pipe_fd[0], F_SETFL, 0 ) ) + /* if( fcntl( param1.pipe_fd[0], F_SETFL, 0 ) ) { wperror( L"fcntl" ); return; } */ - debug(4, L"io_buffer_read: blocking read on fd %d", d->param1.pipe_fd[0]); + debug(4, L"io_buffer_t::read: blocking read on fd %d", param1.pipe_fd[0]); while (1) { char b[4096]; long l; - l=read_blocked(d->param1.pipe_fd[0], b, 4096); + l=read_blocked(param1.pipe_fd[0], b, 4096); if (l==0) { break; @@ -115,15 +115,15 @@ void io_buffer_read(io_buffer_t *d) { debug(1, _(L"An error occured while reading output from code block on file descriptor %d"), - d->param1.pipe_fd[0]); - wperror(L"io_buffer_read"); + param1.pipe_fd[0]); + wperror(L"io_buffer_t::read"); } break; } else { - d->out_buffer_append(b, l); + out_buffer_append(b, l); } } } @@ -164,6 +164,11 @@ public: } /** + Close output pipe, and read from input pipe until eof. + */ + void read(); + + /** Create a IO_BUFFER type io redirection, complete with a pipe and a vector<char> for output. The default file descriptor used is 1 for output buffering and 0 for input buffering. @@ -212,11 +217,6 @@ shared_ptr<const io_data_t> io_chain_get(const io_chain_t &src, int fd); shared_ptr<io_data_t> io_chain_get(io_chain_t &src, int fd); -/** - Close output pipe, and read from input pipe until eof. -*/ -void io_buffer_read(io_buffer_t *d); - /** Print debug information about the specified IO redirection chain to stderr. */ void io_print(const io_chain_t &chain); @@ -1143,7 +1143,7 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c parser.eval(cmd, io_chain, TOP); term_steal(); - io_buffer_read(out.get()); + out->read(); int nil=0; out->out_buffer_append((char *)&nil, 1); |