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. diff --git a/src/core/os.c b/src/core/os.c index 34a9e9d2..7a8162c3 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); @@ -1307,6 +1317,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"