From 0485078c6c57557f6d0f1a5c0888b81ddb33dab5 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Tue, 1 Sep 2020 21:47:08 -0500 Subject: [PATCH] Fix some issues on BSD and Windows. --- src/core/os.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/os.c b/src/core/os.c index 23a550b4..2001be6c 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef JANET_APPLE #include @@ -438,9 +439,11 @@ static Janet os_execute(int32_t argc, Janet *argv) { janet_panic("expected at least 1 command line argument"); } + /* Optional stdio redirections */ + JanetFile *new_in = NULL, *new_out = NULL, *new_err = NULL; + #ifndef JANET_WINDOWS /* Get optional redirections */ - JanetFile *new_in = NULL, *new_out = NULL, *new_err = NULL; if (argc > 2) { JanetDictView tab = janet_getdictionary(argv, 2); Janet maybe_stdin = janet_dictionary_get(tab.kvs, tab.cap, janet_ckeywordv("in")); @@ -475,7 +478,7 @@ static Janet os_execute(int32_t argc, Janet *argv) { char *empty_env[1] = {NULL}; char **envp1 = (NULL == envp) ? empty_env : envp; - int spawn_type = is_async ? : _P_NOWAIT : _P_WAIT; + int spawn_type = is_async ? _P_NOWAIT : _P_WAIT; intptr_t spawn_result; if (janet_flag_at(flags, 1) && janet_flag_at(flags, 0)) { spawn_result = (int) _spawnvpe(spawn_type, path, cargv, envp1);