diff options
author | 2014-09-22 10:16:16 -0700 | |
---|---|---|
committer | 2014-09-22 10:16:16 -0700 | |
commit | e5aa06991e101d3bd86a101d0fe8fb2ed104ef93 (patch) | |
tree | da53fbbd6e3828920f7c8bc79c5ad1e16dbb2f85 /exec.cpp | |
parent | cb40507b7bc2a88d49af1bdcbbd092f97ae7aa69 (diff) |
Remove INTERNAL_BUFFER, which was only used by fish_pager
Diffstat (limited to 'exec.cpp')
-rw-r--r-- | exec.cpp | 67 |
1 files changed, 2 insertions, 65 deletions
@@ -603,11 +603,7 @@ void exec_job(parser_t &parser, job_t *j) debug(4, L"Exec job '%ls' with id %d", j->command_wcstr(), j->job_id); - /* PCA Here we detect the special case of an input buffer redirection, i.e. we want a process to receive data that we hold in a buffer (it is an INPUT for the process, but an output for fish). This is extremely rare: I believe only run_pager creates these and it would be nice to dump it. So we can only have at most one. - - It would be great to wean fish_pager off of input redirections so that we can dump input redirections and the INTERNAL_BUFFER process type altogether. - */ - const io_buffer_t *single_magic_input_redirect = NULL; + /* Verify that all IO_BUFFERs are output. We used to support a (single, hacked-in) magical input IO_BUFFER used by fish_pager, but now the claim is that there are no more clients and it is removed. This assertion double-checks that. */ const io_chain_t all_ios = j->all_io_redirections(); for (size_t idx = 0; idx < all_ios.size(); idx++) { @@ -616,23 +612,7 @@ void exec_job(parser_t &parser, job_t *j) if ((io->io_mode == IO_BUFFER)) { CAST_INIT(io_buffer_t *, io_buffer, io.get()); - if (io_buffer->is_input) - { - /* We expect to have at most one of these, per the comment above. Note that this assertion is the only reason we don't break out of the loop below */ - assert(single_magic_input_redirect == NULL && "Should have at most one input IO_BUFFER"); - - /* - Input redirection - create a new gobetween process to take - care of buffering, save the redirection in input_redirect - */ - process_t *fake = new process_t(); - fake->type = INTERNAL_BUFFER; - fake->pipe_write_fd = STDOUT_FILENO; - j->first_process->pipe_read_fd = io->fd; - fake->next = j->first_process; - j->first_process = fake; - single_magic_input_redirect = io_buffer; - } + assert(! io_buffer->is_input); } } @@ -1118,11 +1098,6 @@ void exec_job(parser_t &parser, job_t *j) /* We should have handled exec up above */ assert(0 && "INTERNAL_EXEC process found in pipeline, where it should never be. Aborting."); break; - - case INTERNAL_BUFFER: - /* Internal buffers are handled in the next switch statement below */ - break; - } if (exec_error) @@ -1214,44 +1189,6 @@ void exec_job(parser_t &parser, job_t *j) } - - case INTERNAL_BUFFER: - { - assert(single_magic_input_redirect != NULL); - const char *buffer = single_magic_input_redirect->out_buffer_ptr(); - size_t count = single_magic_input_redirect->out_buffer_size(); - - /* We don't have to drain threads here because our child process is simple */ - if (g_log_forks) - { - printf("fork #%d: Executing fork for internal buffer for '%ls'\n", g_fork_count, p->argv0() ? p->argv0() : L"(null)"); - } - pid = execute_fork(false); - if (pid == 0) - { - /* - This is the child process. Write out the - contents of the pipeline. - */ - p->pid = getpid(); - setup_child_process(j, p, process_net_io_chain); - - exec_write_and_exit(1, buffer, count, 0); - } - else - { - /* - This is the parent process. Store away - information on the child, and possibly give - it control over the terminal. - */ - p->pid = pid; - set_child_group(j, p, 0); - } - - break; - } - case INTERNAL_BUILTIN: { /* |