Split out io_close_t

This commit is contained in:
Cheer Xiao 2013-01-09 16:02:04 +08:00
parent 4e672427bc
commit f1b375b042
3 changed files with 17 additions and 4 deletions

8
io.cpp
View file

@ -67,12 +67,14 @@ void io_data_t::print() const
case IO_BUFFER:
fprintf(stderr, "buffer %p (size %lu)\n", out_buffer_ptr(), out_buffer_size());
break;
case IO_CLOSE:
fprintf(stderr, "close %d\n", fd);
break;
}
}
void io_close_t::print() const
{
fprintf(stderr, "close %d\n", fd);
}
void io_buffer_read(io_data_t *d)
{
exec_close(d->param1.pipe_fd[1]);

11
io.h
View file

@ -116,6 +116,17 @@ public:
}
};
class io_close_t : public io_data_t
{
public:
io_close_t(int f) :
io_data_t(IO_CLOSE, f)
{
}
virtual void print() const;
};
class io_chain_t : public std::vector<shared_ptr<io_data_t> >
{
public:

View file

@ -1601,7 +1601,7 @@ void parser_t::parse_job_argument_list(process_t *p,
{
if (target == L"-")
{
new_io.reset(new io_data_t(IO_CLOSE, fd));
new_io.reset(new io_close_t(fd));
}
else
{