+2001-12-08 Bruno Haible <bruno@clisp.org>
+
+ * pipe-in.c (create_pipe_in): Don't redirect stdin if prog_stdin
+ is NULL.
+ * pipe-out.c (create_pipe_out): Don't redirect stdout if prog_stdout
+ is NULL.
+
2001-11-24 Bruno Haible <bruno@clisp.org>
* javaexec.h (execute_java_class): New argument 'quiet'.
/* Open a pipe for input from a child process.
- * The child's stdin comes to a file.
+ * The child's stdin comes from a file.
*
* read system write
* parent <- fd[0] <- STDOUT_FILENO <- child
"/dev/null", O_RDWR,
0))
!= 0)
- || (err = posix_spawn_file_actions_addopen (&actions,
- STDIN_FILENO,
- prog_stdin, O_RDONLY,
- 0)) != 0
+ || (prog_stdin != NULL
+ && (err = posix_spawn_file_actions_addopen (&actions,
+ STDIN_FILENO,
+ prog_stdin, O_RDONLY,
+ 0))
+ != 0)
|| (err = posix_spawnp (&child, prog_path, &actions, NULL, prog_argv,
environ)) != 0))
{
&& (nulloutfd == STDERR_FILENO
|| (dup2 (nulloutfd, STDERR_FILENO) >= 0
&& close (nulloutfd) >= 0))))
- && (stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
- && (stdinfd == STDIN_FILENO
- || (dup2 (stdinfd, STDIN_FILENO) >= 0
- && close (stdinfd) >= 0)))
+ && (prog_stdin == NULL
+ || ((stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
+ && (stdinfd == STDIN_FILENO
+ || (dup2 (stdinfd, STDIN_FILENO) >= 0
+ && close (stdinfd) >= 0)))))
execvp (prog_path, prog_argv);
_exit (127);
}
"/dev/null", O_RDWR,
0))
!= 0)
- || (err = posix_spawn_file_actions_addopen (&actions,
- STDOUT_FILENO,
- prog_stdout, O_WRONLY,
- 0)) != 0
+ || (prog_stdout != NULL
+ && (err = posix_spawn_file_actions_addopen (&actions,
+ STDOUT_FILENO,
+ prog_stdout, O_WRONLY,
+ 0))
+ != 0)
|| (err = posix_spawnp (&child, prog_path, &actions, NULL, prog_argv,
environ)) != 0))
{
&& (nulloutfd == STDERR_FILENO
|| (dup2 (nulloutfd, STDERR_FILENO) >= 0
&& close (nulloutfd) >= 0))))
- && (stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
- && (stdoutfd == STDOUT_FILENO
- || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
- && close (stdoutfd) >= 0)))
+ && (prog_stdout == NULL
+ || ((stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
+ && (stdoutfd == STDOUT_FILENO
+ || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
+ && close (stdoutfd) >= 0)))))
execvp (prog_path, prog_argv);
_exit (127);
}
int fd[1]));
/* Open a pipe for input from a child process.
- * The child's stdin comes to a file.
+ * The child's stdin comes from a file.
*
* read system write
* parent <- fd[0] <- STDOUT_FILENO <- child