From 57b08a57a03527418a223cfca2ee40f100a471e4 Mon Sep 17 00:00:00 2001 From: DEADB17 Date: Tue, 31 Mar 2020 23:32:17 -0400 Subject: [PATCH 1/2] Corret typo and match wording for consistency --- src/boot/boot.janet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 114d0d5a..d17b613b 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -942,7 +942,7 @@ (reduce fop x forms)) (defmacro -?> - "Short circuit threading macro. Inserts x as the last value in the first form + "Short circuit threading macro. Inserts x as the second value in the first form in forms, and inserts the modified first form into the second form in the same manner, and so on. The pipeline will return nil if an intermediate value is nil. @@ -958,7 +958,7 @@ (reduce fop x forms)) (defmacro -?>> - "Threading macro. Inserts x as the last value in the first form + "Short circuit threading macro. Inserts x as the last value in the first form in forms, and inserts the modified first form into the second form in the same manner, and so on. The pipeline will return nil if an intermediate value is nil. From 3c2b1baff241fd01bfa9d51ca31a64bcea17b687 Mon Sep 17 00:00:00 2001 From: Andrew Chambers Date: Thu, 2 Apr 2020 23:33:50 +1300 Subject: [PATCH 2/2] Add os/umask. --- src/core/os.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/os.c b/src/core/os.c index a895df3e..8b1d168e 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -797,6 +797,16 @@ static Janet os_symlink(int32_t argc, Janet *argv) { #endif } +static Janet os_umask(int32_t argc, Janet *argv) { + janet_fixarity(argc, 1); +#ifdef JANET_WINDOWS + janet_panicf("os/umask not supported on Windows"); +#else + int32_t mask = janet_getinteger(argv, 0); + return janet_wrap_integer(umask(mask)); +#endif +} + static Janet os_mkdir(int32_t argc, Janet *argv) { janet_fixarity(argc, 1); const char *path = janet_getcstring(argv, 0); @@ -1285,6 +1295,11 @@ static const JanetReg os_cfuns[] = { JDOC("(os/cd path)\n\n" "Change current directory to path. Returns nil on success, errors on failure.") }, + { + "os/umask", os_umask, + JDOC("(os/umask mask)\n\n" + "Set a new umask, returns the old umask.") + }, { "os/mkdir", os_mkdir, JDOC("(os/mkdir path)\n\n"