diff --git a/test/test-list.h b/test/test-list.h index 557a2a7c..2aae8acf 100644 --- a/test/test-list.h +++ b/test/test-list.h @@ -90,6 +90,7 @@ TEST_DECLARE (spawn_exit_code) TEST_DECLARE (spawn_stdout) TEST_DECLARE (spawn_stdin) TEST_DECLARE (spawn_and_kill) +TEST_DECLARE (spawn_and_kill_with_std) TEST_DECLARE (spawn_and_ping) TEST_DECLARE (kill) TEST_DECLARE (fs_file_noent) @@ -241,6 +242,7 @@ TASK_LIST_START TEST_ENTRY (spawn_stdout) TEST_ENTRY (spawn_stdin) TEST_ENTRY (spawn_and_kill) + TEST_ENTRY (spawn_and_kill_with_std) TEST_ENTRY (spawn_and_ping) TEST_ENTRY (kill) #ifdef _WIN32 diff --git a/test/test-spawn.c b/test/test-spawn.c index 68720114..a4d69437 100644 --- a/test/test-spawn.c +++ b/test/test-spawn.c @@ -231,6 +231,37 @@ TEST_IMPL(spawn_and_kill) { } +TEST_IMPL(spawn_and_kill_with_std) { + int r; + uv_pipe_t out; + uv_pipe_t in; + + init_process_options("spawn_helper4", kill_cb); + + uv_pipe_init(uv_default_loop(), &out, 0); + uv_pipe_init(uv_default_loop(), &in, 0); + options.stdout_stream = &out; + options.stdin_stream = ∈ + + r = uv_spawn(uv_default_loop(), &process, options); + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 500, 0); + ASSERT(r == 0); + + r = uv_run(uv_default_loop()); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* Once for process and once for timer. */ + + return 0; +} + + TEST_IMPL(spawn_and_ping) { uv_write_t write_req; uv_pipe_t in, out;