strip windows newlines on nix
This commit is contained in:
parent
e455af7f1f
commit
118608999c
@ -133,6 +133,7 @@ func NewAgentConfig() *rmm.AgentConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) RunScript(code string, shell string, args []string, timeout int) (stdout, stderr string, exitcode int, e error) {
|
func (a *Agent) RunScript(code string, shell string, args []string, timeout int) (stdout, stderr string, exitcode int, e error) {
|
||||||
|
code = removeWinNewLines(code)
|
||||||
content := []byte(code)
|
content := []byte(code)
|
||||||
|
|
||||||
f, err := os.CreateTemp("", "trmm")
|
f, err := os.CreateTemp("", "trmm")
|
||||||
|
@ -298,3 +298,7 @@ func randRange(min, max int) int {
|
|||||||
func randomCheckDelay() {
|
func randomCheckDelay() {
|
||||||
time.Sleep(time.Duration(randRange(300, 950)) * time.Millisecond)
|
time.Sleep(time.Duration(randRange(300, 950)) * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeWinNewLines(s string) string {
|
||||||
|
return strings.ReplaceAll(s, "\r\n", "\n")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user