aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Cholewiński <harry666t@gmail.com>2018-01-04 21:29:03 +0100
committerKamil Cholewiński <harry666t@gmail.com>2018-01-04 21:29:03 +0100
commitf9106ca0a9dc73b0f793b47ae8f454abb76330af (patch)
treed1bce4e6ea2bb3e71ae56b912dfeb8ae762b93b8
parentc47dee1b2c47f46eb0146ede14de5ac8cc2fc7b8 (diff)
downloadjudo-f9106ca0a9dc73b0f793b47ae8f454abb76330af.zip
judo-f9106ca0a9dc73b0f793b47ae8f454abb76330af.tar.gz
judo-f9106ca0a9dc73b0f793b47ae8f454abb76330af.tar.bz2
Add missing workdir check
-rw-r--r--transport.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/transport.go b/transport.go
index afdc621..afaafad 100644
--- a/transport.go
+++ b/transport.go
@@ -67,7 +67,11 @@ func shargs(ss []string) string {
func (host *Host) startSSH(job *Job, command string) (proc *Proc, err error) {
sshArgs := []string{host.Name}
- sshArgs = append(sshArgs, []string{"cd", host.workdir, "&&"}...)
+ if host.workdir != "" {
+ sshArgs = append(sshArgs, []string{
+ "cd", host.workdir, "&&",
+ }...)
+ }
sshArgs = append(sshArgs, []string{"env"}...)
for key, value := range host.Env {
sshArgs = append(sshArgs, fmt.Sprintf("%s=%s", key, value))