Skip to content

Commit

Permalink
fix: fix issue #37
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
windvalley committed May 29, 2024
1 parent 92e3206 commit bf687ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/batchssh/batchssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ func (c *Client) ExecuteScript(
command := ""
switch {
case sudo && remove:
command = fmt.Sprintf("%ssudo -u %s -H bash -c '%s;rm -f %s'", exportLang, runAs, script, script)
command = fmt.Sprintf("%ssudo -u %s -H bash -c '%s;rc=$?;rm -f %s;exit $rc'", exportLang, runAs, script, script)
case sudo && !remove:
command = fmt.Sprintf("%ssudo -u %s -H bash -c '%s'", exportLang, runAs, script)
case !sudo && remove:
command = fmt.Sprintf("%s%s;rm -f %s", exportLang, script, script)
command = fmt.Sprintf("%s%s;rc=$?;rm -f %s;exit $rc", exportLang, script, script)
case !sudo && !remove:
command = exportLang + script
}
Expand Down

0 comments on commit bf687ea

Please sign in to comment.