summaryrefslogtreecommitdiff
path: root/deps/uv/test/test-spawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/test/test-spawn.c')
-rw-r--r--deps/uv/test/test-spawn.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index a3856d1c8e..0f4389f18c 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -171,6 +171,7 @@ TEST_IMPL(spawn_fails) {
r = uv_spawn(uv_default_loop(), &process, &options);
ASSERT(r == UV_ENOENT || r == UV_EACCES);
ASSERT(0 == uv_is_active((uv_handle_t*) &process));
+ uv_close((uv_handle_t*) &process, NULL);
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
MAKE_VALGRIND_HAPPY();
@@ -690,9 +691,9 @@ TEST_IMPL(spawn_closed_process_io) {
uv_write_t write_req;
uv_buf_t buf;
uv_stdio_container_t stdio[2];
- static char buffer[] = "hello-from-spawn_stdin";
+ static char buffer[] = "hello-from-spawn_stdin\n";
- init_process_options("spawn_helper1", exit_cb);
+ init_process_options("spawn_helper3", exit_cb);
uv_pipe_init(uv_default_loop(), &in, 0);
options.stdio = stdio;
@@ -836,6 +837,7 @@ TEST_IMPL(argument_escaping) {
WCHAR* non_verbatim_output;
test_output = calloc(count, sizeof(WCHAR*));
+ ASSERT(test_output != NULL);
for (i = 0; i < count; ++i) {
test_output[i] = calloc(2 * (wcslen(test_str[i]) + 2), sizeof(WCHAR));
quote_cmd_arg(test_str[i], test_output[i]);
@@ -844,6 +846,7 @@ TEST_IMPL(argument_escaping) {
total_size += wcslen(test_output[i]) + 1;
}
command_line = calloc(total_size + 1, sizeof(WCHAR));
+ ASSERT(command_line != NULL);
for (i = 0; i < count; ++i) {
wcscat(command_line, test_output[i]);
wcscat(command_line, L" ");
@@ -935,6 +938,28 @@ TEST_IMPL(environment_creation) {
return 0;
}
+
+// Regression test for issue #909
+TEST_IMPL(spawn_with_an_odd_path) {
+ int r;
+
+ char newpath[2048];
+ char *path = getenv("PATH");
+ ASSERT(path != NULL);
+ snprintf(newpath, 2048, ";.;%s", path);
+ SetEnvironmentVariable("PATH", path);
+
+ init_process_options("", exit_cb);
+ options.file = options.args[0] = "program-that-had-better-not-exist";
+ r = uv_spawn(uv_default_loop(), &process, &options);
+ ASSERT(r == UV_ENOENT || r == UV_EACCES);
+ ASSERT(0 == uv_is_active((uv_handle_t*) &process));
+ uv_close((uv_handle_t*) &process, NULL);
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
#endif
#ifndef _WIN32