1
1

corrections for stdin - stdin shouldn't be using same pty

as stdout - corrects duplicate output

This commit was SVN r5925.
Этот коммит содержится в:
Tim Woodall 2005-06-02 19:17:32 +00:00
родитель 78d713b70a
Коммит e406a4b1aa

Просмотреть файл

@ -61,11 +61,13 @@ orte_iof_base_setup_prefork(orte_iof_base_io_conf_t *opts)
#endif
fflush(stdout);
#if defined(HAVE_OPENPTY) && OMPI_ENABLE_PTY_SUPPORT
if (opts->usepty) {
ret = openpty(&(opts->p_stdout[0]), &(opts->p_stdout[1]),
NULL, NULL, NULL);
ret = openpty(&(opts->p_stdin[0]), &(opts->p_stdin[1]),
NULL, NULL, NULL);
} else {
ret = -1;
}
@ -105,7 +107,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
{
int ret;
if (! opts->usepty) {
if (!opts->usepty) {
close(opts->p_stdout[0]);
close(opts->p_stdin[1]);
}
@ -113,7 +115,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
if (opts->usepty) {
if (opts->connect_stdin) {
ret = dup2(opts->p_stdout[1], fileno(stdin));
ret = dup2(opts->p_stdin[0], fileno(stdin));
if (ret < 0) return OMPI_ERROR;
} else {
int fd;
@ -134,9 +136,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
}
if (opts->connect_stdin) {
if(opts->p_stdin[0] != fileno(stdin)) {
ret = dup2(opts->p_stdin[1], fileno(stdin));
ret = dup2(opts->p_stdin[0], fileno(stdin));
if (ret < 0) return OMPI_ERROR;
close(opts->p_stdin[1]);
close(opts->p_stdin[0]);
}
} else {
int fd;
@ -155,7 +157,6 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
if (ret < 0) return OMPI_ERROR;
close(opts->p_stderr[1]);
}
return OMPI_SUCCESS;
}
@ -172,11 +173,10 @@ orte_iof_base_setup_parent(const orte_process_name_t* name,
}
close(opts->p_stderr[1]);
/* connect stdin endpoint */
/* connect write end to IOF */
if (opts->connect_stdin) {
ret = orte_iof.iof_publish(name, ORTE_IOF_SINK,
ORTE_IOF_STDIN, opts->usepty ?
opts->p_stdout[0] : opts->p_stdin[1]);
ORTE_IOF_STDIN, opts->p_stdin[1]);
if(ORTE_SUCCESS != ret) {
ORTE_ERROR_LOG(ret);
return ret;