diff options
-rw-r--r-- | exec.cpp | 6 | ||||
-rw-r--r-- | io.cpp | 2 | ||||
-rw-r--r-- | io.h | 28 | ||||
-rw-r--r-- | reader.cpp | 4 |
4 files changed, 20 insertions, 20 deletions
@@ -801,7 +801,7 @@ void exec(parser_t &parser, job_t *j) if (p->next) { - io_buffer.reset(io_buffer_create(0)); + io_buffer.reset(io_buffer_t::create(0)); j->io.push_back(io_buffer); } @@ -818,7 +818,7 @@ void exec(parser_t &parser, job_t *j) { if (p->next) { - io_buffer.reset(io_buffer_create(0)); + io_buffer.reset(io_buffer_t::create(0)); j->io.push_back(io_buffer); } @@ -1409,7 +1409,7 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst) is_subshell=1; - const shared_ptr<io_buffer_t> io_buffer(io_buffer_create(0)); + const shared_ptr<io_buffer_t> io_buffer(io_buffer_t::create(0)); prev_status = proc_get_last_status(); @@ -130,7 +130,7 @@ void io_buffer_read(io_buffer_t *d) } -io_buffer_t *io_buffer_create(bool is_input) +io_buffer_t *io_buffer_t::create(bool is_input) { bool success = true; io_buffer_t *buffer_redirect = new io_buffer_t(is_input ? 0 : 1); @@ -119,15 +119,15 @@ private: /** buffer to save output in */ shared_ptr<std::vector<char> > out_buffer; -public: - virtual void print() const; - io_buffer_t(int f): io_data_t(IO_BUFFER, f), out_buffer() { } +public: + virtual void print() const; + ~io_buffer_t(); /** Function to create the output buffer */ @@ -162,6 +162,17 @@ public: assert(out_buffer.get() != NULL); return out_buffer->size(); } + + /** + 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. + + \param is_input set this parameter to zero if the buffer should be + used to buffer the output of a command, or non-zero to buffer the + input to a command. + */ + static io_buffer_t *create(bool is_input); }; class io_chain_t : public std::vector<shared_ptr<io_data_t> > @@ -202,17 +213,6 @@ shared_ptr<io_data_t> io_chain_get(io_chain_t &src, int fd); /** - 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. - - \param is_input set this parameter to zero if the buffer should be - used to buffer the output of a command, or non-zero to buffer the - input to a command. -*/ -io_buffer_t *io_buffer_create(bool is_input); - -/** Close output pipe, and read from input pipe until eof. */ void io_buffer_read(io_buffer_t *d); @@ -1064,7 +1064,7 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c is_quoted?L"-q":L"", prefix_esc.c_str()); - shared_ptr<io_buffer_t> in(io_buffer_create(true)); + shared_ptr<io_buffer_t> in(io_buffer_t::create(true)); in->fd = 3; escaped_separator = escape(COMPLETE_SEP_STR, 1); @@ -1133,7 +1133,7 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c term_donate(); - shared_ptr<io_buffer_t> out(io_buffer_create(false)); + shared_ptr<io_buffer_t> out(io_buffer_t::create(false)); out->fd = 4; parser_t &parser = parser_t::principal_parser(); |