diff options
| author | Jeff Carr <[email protected]> | 2019-06-06 15:59:49 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-06-06 15:59:49 -0700 |
| commit | f59e1b1f8403216d435e4904550eb6c2844ce690 (patch) | |
| tree | fbee32ba3e521b82de8ad4a6722cf6155445bf72 /shell.go | |
| parent | d7a665031c8f95eb6c96bbdc642fe3ab74e851cf (diff) | |
add perl 'chomp'. too lazy to make it correct with regex
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'shell.go')
| -rw-r--r-- | shell.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -44,7 +44,7 @@ func Script(cmds string) int { lines := strings.Split(strings.Replace(cmds, "\r\n", "\n", -1), "\n") for _, line := range lines { - line = strings.TrimSpace(line) // this is like 'chomp' in perl + line = Chomp(line) // this is like 'chomp' in perl log.Println("LINE:", line) time.Sleep(1) Run(line) @@ -79,7 +79,7 @@ func SetStderr(newerr *os.File) { func Run(cmdline string) string { log.Println("shell.Run() START " + cmdline) - cmd := strings.TrimSpace(cmdline) // this is like 'chomp' in perl + cmd := Chomp(cmdline) // this is like 'chomp' in perl cmdArgs := strings.Fields(cmd) if (len(cmdArgs) == 0) { callback(fmt.Errorf("cmdline == ''"), 0) @@ -191,7 +191,7 @@ func Run(cmdline string) string { log.Println("shell.Run() END ", cmdline) log.Println("shell.Run() calling callback() :") callback(fmt.Errorf("no error"), 0) - return string(b) + return Chomp(b) } func Daemon(cmdline string, timeout time.Duration) int { |
