Skip to content

Commit 46e94bd

Browse files
committed
Merge pull request #5 from shazow/env
Include full host environ vars with -e flag.
2 parents 6a8a3ae + 172f424 commit 46e94bd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

execd.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ func handleChannel(conn *ssh.ServerConn, newChan ssh.NewChannel, execHandler []s
312312
}
313313
cmd = exec.Command(execHandler[0], append(execHandler[1:], cmdargs...)...)
314314
}
315-
if !*env {
315+
if *env {
316+
cmd.Env = os.Environ()
317+
} else {
316318
cmd.Env = []string{}
317319
}
318320
if conn.Permissions != nil {
@@ -347,7 +349,9 @@ func handleChannel(conn *ssh.ServerConn, newChan ssh.NewChannel, execHandler []s
347349
} else {
348350
cmd = exec.Command(execHandler[0], execHandler[1:]...)
349351
}
350-
if !*env {
352+
if *env {
353+
cmd.Env = os.Environ()
354+
} else {
351355
cmd.Env = []string{}
352356
}
353357
if conn.Permissions != nil {

0 commit comments

Comments
 (0)