From 8255af645a6a0a7393beca0602f76e127d13fd70 Mon Sep 17 00:00:00 2001 From: sagie gur ari Date: Sun, 8 Mar 2020 14:31:27 +0000 Subject: [PATCH] chmod glob should exit with fase in case any chmod failed. --- docs/sdk.md | 11 ++++++++--- duckscript_sdk/src/sdk/std/fs/set_mode_glob/script.ds | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/sdk.md b/docs/sdk.md index 3af9536..5cdec70 100644 --- a/docs/sdk.md +++ b/docs/sdk.md @@ -2923,15 +2923,20 @@ assert ${readonly} ```sh scope::glob_chmod::handle = glob_array ${scope::glob_chmod::argument::2} -scope::glob_chmod::count = array_length ${scope::glob_chmod::handle} +scope::glob_chmod::output = array_length ${scope::glob_chmod::handle} for scope::glob_chmod::entry in ${scope::glob_chmod::handle} - chmod ${scope::glob_chmod::argument::1} ${scope::glob_chmod::entry} + scope::glob_chmod::result = chmod ${scope::glob_chmod::argument::1} ${scope::glob_chmod::entry} + + if equals ${scope::glob_chmod::result} false + release ${scope::glob_chmod::handle} + scope::glob_chmod::output = set false + end end release ${scope::glob_chmod::handle} -set ${scope::glob_chmod::count} +set ${scope::glob_chmod::output} ``` diff --git a/duckscript_sdk/src/sdk/std/fs/set_mode_glob/script.ds b/duckscript_sdk/src/sdk/std/fs/set_mode_glob/script.ds index 9b048db..bcc46f6 100644 --- a/duckscript_sdk/src/sdk/std/fs/set_mode_glob/script.ds +++ b/duckscript_sdk/src/sdk/std/fs/set_mode_glob/script.ds @@ -1,11 +1,16 @@ scope::glob_chmod::handle = glob_array ${scope::glob_chmod::argument::2} -scope::glob_chmod::count = array_length ${scope::glob_chmod::handle} +scope::glob_chmod::output = array_length ${scope::glob_chmod::handle} for scope::glob_chmod::entry in ${scope::glob_chmod::handle} - chmod ${scope::glob_chmod::argument::1} ${scope::glob_chmod::entry} + scope::glob_chmod::result = chmod ${scope::glob_chmod::argument::1} ${scope::glob_chmod::entry} + + if equals ${scope::glob_chmod::result} false + release ${scope::glob_chmod::handle} + scope::glob_chmod::output = set false + end end release ${scope::glob_chmod::handle} -set ${scope::glob_chmod::count} +set ${scope::glob_chmod::output}