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