1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00

Merge branch 'master' of github.com:janet-lang/janet

This commit is contained in:
Calvin Rose 2020-04-03 15:04:39 -05:00
commit edb2fab64c
2 changed files with 17 additions and 2 deletions

View File

@ -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.

View File

@ -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"