mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Put io_data_t detail printing in virtual io_data_t::print
This commit is contained in:
parent
89993e9cbf
commit
165068c81d
2 changed files with 25 additions and 18 deletions
41
io.cpp
41
io.cpp
|
@ -51,6 +51,28 @@ Utilities for io redirection.
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
|
|
||||||
|
void io_data_t::print() const
|
||||||
|
{
|
||||||
|
switch (io_mode)
|
||||||
|
{
|
||||||
|
case IO_FILE:
|
||||||
|
fprintf(stderr, "file (%s)\n", filename_cstr);
|
||||||
|
break;
|
||||||
|
case IO_PIPE:
|
||||||
|
fprintf(stderr, "pipe {%d, %d}\n", param1.pipe_fd[0], param1.pipe_fd[1]);
|
||||||
|
break;
|
||||||
|
case IO_FD:
|
||||||
|
fprintf(stderr, "FD map %d -> %d\n", param1.old_fd, fd);
|
||||||
|
break;
|
||||||
|
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_buffer_read(io_data_t *d)
|
void io_buffer_read(io_data_t *d)
|
||||||
{
|
{
|
||||||
exec_close(d->param1.pipe_fd[1]);
|
exec_close(d->param1.pipe_fd[1]);
|
||||||
|
@ -195,24 +217,7 @@ void io_print(const io_chain_t &chain)
|
||||||
{
|
{
|
||||||
const shared_ptr<const io_data_t> &io = chain.at(i);
|
const shared_ptr<const io_data_t> &io = chain.at(i);
|
||||||
fprintf(stderr, "\t%lu: fd:%d, input:%s, ", (unsigned long)i, io->fd, io->is_input ? "yes" : "no");
|
fprintf(stderr, "\t%lu: fd:%d, input:%s, ", (unsigned long)i, io->fd, io->is_input ? "yes" : "no");
|
||||||
switch (io->io_mode)
|
io->print();
|
||||||
{
|
|
||||||
case IO_FILE:
|
|
||||||
fprintf(stderr, "file (%s)\n", io->filename_cstr);
|
|
||||||
break;
|
|
||||||
case IO_PIPE:
|
|
||||||
fprintf(stderr, "pipe {%d, %d}\n", io->param1.pipe_fd[0], io->param1.pipe_fd[1]);
|
|
||||||
break;
|
|
||||||
case IO_FD:
|
|
||||||
fprintf(stderr, "FD map %d -> %d\n", io->param1.old_fd, io->fd);
|
|
||||||
break;
|
|
||||||
case IO_BUFFER:
|
|
||||||
fprintf(stderr, "buffer %p (size %lu)\n", io->out_buffer_ptr(), io->out_buffer_size());
|
|
||||||
break;
|
|
||||||
case IO_CLOSE:
|
|
||||||
fprintf(stderr, "close %d\n", io->fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
io.h
2
io.h
|
@ -94,6 +94,8 @@ public:
|
||||||
return out_buffer->size();
|
return out_buffer->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void print() const;
|
||||||
|
|
||||||
/** Set to true if this is an input io redirection */
|
/** Set to true if this is an input io redirection */
|
||||||
bool is_input;
|
bool is_input;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue