File tree 2 files changed +10
-12
lines changed
2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1
- .idea
1
+ /.idea /
2
+ /.repo /
2
3
ci /bin
3
4
cmd /coder /coder
Original file line number Diff line number Diff line change 5
5
"io"
6
6
"os"
7
7
"os/signal"
8
+ "strings"
8
9
"time"
9
10
10
11
"github.com/spf13/pflag"
@@ -79,22 +80,18 @@ func (cmd *shellCmd) Run(fl *pflag.FlagSet) {
79
80
}
80
81
var (
81
82
envName = fl .Arg (0 )
82
- command = fl .Arg (1 )
83
83
ctx = context .Background ()
84
84
)
85
85
86
- var args []string
87
- if command != "" {
88
- args = fl .Args ()[2 :]
86
+ args := []string {"-c" }
87
+ if fl .Arg (1 ) == "" {
88
+ // Bring user into shell if no command is specified.
89
+ args = append (args , "export SHELL=$(getent passwd $(whoami) | awk -F: '{ print $7 }'); $SHELL" )
90
+ } else {
91
+ args = append (args , strings .Join (fl .Args ()[1 :], " " ))
89
92
}
90
93
91
- // Bring user into shell if no command is specified.
92
- if command == "" {
93
- command = "sh"
94
- args = []string {"-c" , "exec $(getent passwd $(whoami) | awk -F: '{ print $7 }')" }
95
- }
96
-
97
- err := runCommand (ctx , envName , command , args )
94
+ err := runCommand (ctx , envName , "sh" , args )
98
95
if exitErr , ok := err .(wsep.ExitError ); ok {
99
96
os .Exit (exitErr .Code )
100
97
}
You can’t perform that action at this time.
0 commit comments