zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit fdeb8765f0dd0d147371b22a28b442c6f19fa36d (tree)
parent cba0d76fbcbaf4e45a277a36fc7f0be0b60c7e14
Author: Shawn Landden <shawn@git.icu>
Date:   Fri, 31 Aug 2018 19:29:06 -0700

use vfork in stage1 compiler to avoid OOM

Diffstat:
Msrc/os.cpp | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/os.cpp b/src/os.cpp @@ -125,7 +125,7 @@ static void populate_termination(Termination *term, int status) { static void os_spawn_process_posix(const char *exe, ZigList<const char *> &args, Termination *term) { pid_t pid = fork(); if (pid == -1) - zig_panic("fork failed"); + zig_panic("fork failed: %s", strerror(errno)); if (pid == 0) { // child const char **argv = allocate<const char *>(args.length + 2); @@ -839,9 +839,9 @@ static int os_exec_process_posix(const char *exe, ZigList<const char *> &args, if ((err = pipe(stderr_pipe))) zig_panic("pipe failed"); - pid_t pid = fork(); + pid_t pid = vfork(); if (pid == -1) - zig_panic("fork failed"); + zig_panic("fork failed: %s", strerror(errno)); if (pid == 0) { // child if (dup2(stdin_pipe[0], STDIN_FILENO) == -1)