aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--exec.cpp4
-rw-r--r--io.cpp18
-rw-r--r--io.h10
-rw-r--r--reader.cpp2
4 files changed, 17 insertions, 17 deletions
diff --git a/exec.cpp b/exec.cpp
index c11d36df..4c6e8bfc 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -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);
diff --git a/io.cpp b/io.cpp
index 4dfd811e..0020659c 100644
--- a/io.cpp
+++ b/io.cpp
@@ -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);
}
}
}
diff --git a/io.h b/io.h
index 30d0dfe2..62087037 100644
--- a/io.h
+++ b/io.h
@@ -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);
diff --git a/reader.cpp b/reader.cpp
index 47779583..f90df311 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -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);