瀏覽代碼

Append NULL to the args before _spawnvp

rexim 4 年之前
父節點
當前提交
ada61e958d
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      nobuild2.h

+ 2 - 1
nobuild2.h

@@ -427,7 +427,8 @@ void cmd_line_run_sync(Cmd_Line cmd_line)
 #ifndef _WIN32
     pid_wait(cmd_line_run_async(cmd_line));
 #else
-    intptr_t status = _spawnvp(_P_WAIT, cmd_line.line.elems[0], (char * const*) cmd_line.line.elems);
+    Cstr_Array args = cstr_array_append(cmd_line.line, NULL);
+    intptr_t status = _spawnvp(_P_WAIT, args.elems[0], (char * const*) args.elems);
     if (status < 0) {
         PANIC("could not start child process: %s", strerror(errno));
     }