Signed-off-by: Xu Xijian hdxuxijian@163.com --- src/scheduler/jobfile_operate.cr | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/scheduler/jobfile_operate.cr b/src/scheduler/jobfile_operate.cr index 4ec9f96..baab515 100644 --- a/src/scheduler/jobfile_operate.cr +++ b/src/scheduler/jobfile_operate.cr @@ -58,14 +58,14 @@ module Jobfile::Operate def self.parse_one(script_lines, key, val) return false if val.as_h?
- if valid_shell_variable?(key) - value = if val.as_a? - shell_escape(val.as_a) - else - shell_escape(val.to_s) - end - script_lines << "\texport #{key}=" + value if value - end + return false unless valid_shell_variable?(key) + + value = if val.as_a? + shell_escape(val.as_a) + else + shell_escape(val.to_s) + end + script_lines << "\texport #{key}=" + value if value end
def self.sh_export_top_env(job_content : Hash)
On Mon, Nov 09, 2020 at 09:42:05PM +0800, Xu Xijian wrote:
Signed-off-by: Xu Xijian hdxuxijian@163.com
src/scheduler/jobfile_operate.cr | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/scheduler/jobfile_operate.cr b/src/scheduler/jobfile_operate.cr index 4ec9f96..baab515 100644 --- a/src/scheduler/jobfile_operate.cr +++ b/src/scheduler/jobfile_operate.cr @@ -58,14 +58,14 @@ module Jobfile::Operate def self.parse_one(script_lines, key, val) return false if val.as_h?
- if valid_shell_variable?(key)
value = if val.as_a?
shell_escape(val.as_a)
else
shell_escape(val.to_s)
end
script_lines << "\texport #{key}=" + value if value
- end
- return false unless valid_shell_variable?(key)
- value = if val.as_a?
shell_escape(val.as_a)
else
shell_escape(val.to_s)
end
Use ternary if? value = val.as_a? ? shell_escape(val.as_a) : shell_escape(val.to_s)
Previous return type is (Bool | String | Nil) Now is (Bool | String) ?
Thanks, RenWen
script_lines << "\texport #{key}=" + value if value end
def self.sh_export_top_env(job_content : Hash)
-- 2.23.0