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 Thu, Nov 12, 2020 at 03:12:12PM +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)
Combine the two return together?
return false if val.as_h? || !valid_shell_variable?(key)
Thanks, Yuanchao
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)
-- 2.23.0
On Thu, Nov 12, 2020 at 03:29:58PM +0800, Li Yuanchao wrote:
On Thu, Nov 12, 2020 at 03:12:12PM +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)
Combine the two return together?
return false if val.as_h? || !valid_shell_variable?(key)
Thanks, Yuanchao
good.
Thanks, Xijian