1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-13 13:57:19 +00:00

Add :a option to os/execute, and allow redirecting stdio.

This should help cover a number of common cases for
use of subprocesses. This should also eventually work well
with the ev branch via
This commit is contained in:
Calvin Rose
2020-09-01 20:06:35 -05:00
parent 6273e56886
commit e7fca0051e
3 changed files with 150 additions and 22 deletions

View File

@@ -162,8 +162,8 @@ static Janet cfun_io_fopen(int32_t argc, Janet *argv) {
}
FILE *f = fopen((const char *)fname, (const char *)fmode);
return f ? janet_makefile(f, flags)
: (flags & JANET_FILE_NONIL) ? (janet_panicf("failed to open file %s: %s", fname, strerror(errno)), janet_wrap_nil())
: janet_wrap_nil();
: (flags & JANET_FILE_NONIL) ? (janet_panicf("failed to open file %s: %s", fname, strerror(errno)), janet_wrap_nil())
: janet_wrap_nil();
}
/* Read up to n bytes into buffer. */