ci: tests for macOS on Gitlab CI
[nit.git] / lib / core / exec.nit
index d5ab952..64d6cc7 100644 (file)
@@ -164,7 +164,7 @@ class Process
                                return NULL;
                        }
                        start_info.hStdInput = in_fd[0];
-                       result->in_fd = _open_osfhandle((intptr_t)in_fd[1], _O_APPEND);
+                       result->in_fd = _open_osfhandle((intptr_t)in_fd[1], _O_WRONLY);
                        if ( !SetHandleInformation(in_fd[1], HANDLE_FLAG_INHERIT, 0) )
                                return NULL;
                } else {
@@ -214,6 +214,10 @@ class Process
                        &start_info,
                        &proc_info);
 
+               if (pipeflag & 1) CloseHandle(in_fd[0]);
+               if (pipeflag & 2) CloseHandle(out_fd[1]);
+               if (pipeflag & 3) CloseHandle(err_fd[1]);
+
                // Error?
                if (!created) {
                        result->running = 0;
@@ -323,6 +327,9 @@ class Process
                                close(err_fd[1]);
                        } else
                                result->err_fd = -1;
+               } else {
+                       perror("Process:");
+                       return NULL;
                }
 
                return result;
@@ -342,7 +349,7 @@ class ProcessReader
 
        redef fun read_char do return stream_in.read_char
 
-       redef fun read_byte do return stream_in.read_byte
+       redef fun raw_read_byte do return stream_in.read_byte
 
        redef fun eof do return stream_in.eof