diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c index a35dff88ad846cc230d348199b112d0f957148fe..cf3153596d64ce198f1164dfe474c650efed5d4c 100644 --- a/src/cmd/isulad-shim/process.c +++ b/src/cmd/isulad-shim/process.c @@ -243,7 +243,7 @@ static void* task_io_copy(void *data) for (;;) { memset(buf, 0, DEFAULT_IO_COPY_BUF); sem_wait(&(io_thd->sem_thd)); - if (io_thd->shutdown) { + if (io_thd->is_stdin && io_thd->shutdown) { break; } @@ -272,6 +272,10 @@ static void* task_io_copy(void *data) } } } + + if (io_thd->shutdown) { + break; + } } struct epoll_event ev; ev.events = EPOLLIN; @@ -328,6 +332,7 @@ static int process_io_start(process_t *p, int std_id) io_thd->epfd = p->io_loop_fd; io_thd->ioc = ioc; io_thd->shutdown = false; + io_thd->is_stdin = std_id == stdid_in ? true : false; io_thd->terminal = std_id != stdid_in ? p->terminal : NULL; p->io_threads[std_id] = io_thd; diff --git a/src/cmd/isulad-shim/process.h b/src/cmd/isulad-shim/process.h index 8df0b59b815829696f00acb2e99dfde1c32edf8d..6d0fb1955e04f765d69bbc694c4a04a40a1b8d70 100644 --- a/src/cmd/isulad-shim/process.h +++ b/src/cmd/isulad-shim/process.h @@ -58,6 +58,7 @@ typedef struct { sem_t sem_thd; io_copy_t *ioc; bool shutdown; + bool is_stdin; log_terminal *terminal; } io_thread_t;