File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
1919// Terminal communicates with the underlying terminal which is running shox
2020type Terminal struct {
2121 shell string
22+ dir string
2223 proxy * proxy.Proxy
2324 pty * os.File
2425 enableNesting bool
@@ -43,6 +44,11 @@ func (t *Terminal) SetShell(shell string) {
4344 t .shell = shell
4445}
4546
47+ // SetDir sets the directory the shell will start in (CWD)
48+ func (t * Terminal ) SetDir (dir string ) {
49+ t .dir = dir
50+ }
51+
4652// AddDecorator adds a decorator to alter the terminal output
4753func (t * Terminal ) AddDecorator (d decorators.Decorator ) {
4854 t .proxy .AddDecorator (d )
@@ -75,6 +81,10 @@ func (t *Terminal) Run() error {
7581 // Create arbitrary command.
7682 c := exec .Command (t .shell )
7783
84+ if t .dir != "" {
85+ c .Dir = t .dir
86+ }
87+
7888 // Start the command with a pty.
7989 var err error
8090 t .pty , err = pty .Start (c )
You can’t perform that action at this time.
0 commit comments