move hyper_watch_exec_pty() after get the process pid

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-29 20:13:53 +08:00
parent 290217c87a
commit 9cd968e2d2
+6 -7
View File
@@ -603,13 +603,6 @@ int hyper_run_process(struct hyper_exec *exec)
goto out;
}
if (hyper_watch_exec_pty(exec) < 0) {
fprintf(stderr, "add pts master event failed\n");
goto close_tty;
}
exec->ref++;
if (pipe2(pipe, O_CLOEXEC) < 0) {
perror("create pipe between pod init execcmd failed");
goto close_tty;
@@ -629,8 +622,14 @@ int hyper_run_process(struct hyper_exec *exec)
goto close_tty;
}
if (hyper_watch_exec_pty(exec) < 0) {
fprintf(stderr, "add pts master event failed\n");
goto close_tty;
}
exec->pid = type;
list_add_tail(&exec->list, &exec->pod->exec_head);
exec->ref++;
fprintf(stdout, "%s process pid %d\n", __func__, exec->pid);
ret = 0;
out: