From 212a60e9bcd46508a4810d3d9e15dd7028ddf196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 17 Feb 2017 17:04:10 +0100 Subject: [PATCH 1/3] run-program: if gray-stream passed, propose continuation If execution is continued, new stream is created. --- src/c/unixsys.d | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 1c1c09b3c..0d30a7b1a 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -494,8 +494,11 @@ create_descriptor(cl_object stream, cl_object direction, HANDLE stream_handle = ecl_stream_to_HANDLE (stream, direction != @':input'); if (stream_handle == INVALID_HANDLE_VALUE) { - FEerror("~S argument to RUN-PROGRAM does not " - "have a file handle:~%~S", 2, direction, stream); + CEerror(make_constant_base_string("Create a new stream."), + "~S argument to RUN-PROGRAM does not have a file handle:~%~S", + 2, direction, stream); + create_descriptor(@':stream', direction, child, parent); + return; } DuplicateHandle(current, stream_handle, current, child, 0, TRUE, @@ -532,8 +535,11 @@ create_descriptor(cl_object stream, cl_object direction, if (*child >= 0) { *child = dup(*child); } else { - FEerror("~S argument to RUN-PROGRAM does not " - "have a file handle:~%~S", 2, direction, stream); + CEerror(make_constant_base_string("Create a new stream."), + "~S argument to RUN-PROGRAM does not have a file handle:~%~S", + 2, direction, stream); + create_descriptor(@':stream', direction, child, parent); + return; } } else { From 1360bc1306784f8dc4b783375153691ed4bd3ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 17 Feb 2017 17:25:12 +0100 Subject: [PATCH 2/3] cosmetic: add comment --- src/c/unixsys.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 0d30a7b1a..468948aa7 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -668,7 +668,7 @@ create_descriptor(cl_object stream, cl_object direction, if (child_stdout) CloseHandle(child_stdout); if (child_stderr) CloseHandle(child_stderr); } -#elif !defined(NACL) /* mingw */ +#elif !defined(NACL) /* All POSIX but NaCL/pNaCL */ { int child_stdin, child_stdout, child_stderr; int pipe_fd[2]; From ee10aa7313b46cd3bbd5ff0a08676dc580740e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 17 Feb 2017 17:58:13 +0100 Subject: [PATCH 3/3] run-program: error stream direction is output --- src/c/unixsys.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 468948aa7..4e9f98749 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -626,7 +626,7 @@ create_descriptor(cl_object stream, cl_object direction, &child_stderr, 0, TRUE, DUPLICATE_SAME_ACCESS); else - create_descriptor(error, @':error', &child_stderr, &parent_error); + create_descriptor(error, @':output', &child_stderr, &parent_error); add_external_process(the_env, process); @@ -680,7 +680,7 @@ create_descriptor(cl_object stream, cl_object direction, if (error == @':output') child_stderr = child_stdout; else - create_descriptor(error, @':error', &child_stderr, &parent_error); + create_descriptor(error, @':output', &child_stderr, &parent_error); add_external_process(the_env, process); pipe(pipe_fd);