@@ -43,6 +43,7 @@ function gritty(element, options = {}) {
43
43
const {
44
44
command,
45
45
autoRestart,
46
+ cwd,
46
47
} = options ;
47
48
48
49
const socket = connect ( prefix , socketPath ) ;
@@ -51,14 +52,15 @@ function gritty(element, options = {}) {
51
52
52
53
return createTerminal ( el , {
53
54
env,
55
+ cwd,
54
56
command,
55
57
autoRestart,
56
58
socket,
57
59
fontFamily,
58
60
} ) ;
59
61
}
60
62
61
- function createTerminal ( terminalContainer , { env, command, autoRestart, socket, fontFamily} ) {
63
+ function createTerminal ( terminalContainer , { env, cwd , command, autoRestart, socket, fontFamily} ) {
62
64
const terminal = new Terminal ( {
63
65
scrollback : 1000 ,
64
66
tabStopWidth : 4 ,
@@ -77,7 +79,7 @@ function createTerminal(terminalContainer, {env, command, autoRestart, socket, f
77
79
78
80
const { cols, rows} = terminal . proposeGeometry ( ) ;
79
81
80
- socket . on ( 'accept' , onConnect ( socket , terminal , { env, cols, rows, command, autoRestart} ) ) ;
82
+ socket . on ( 'accept' , onConnect ( socket , terminal , { env, cwd , cols, rows, command, autoRestart} ) ) ;
81
83
socket . on ( 'disconnect' , onDisconnect ( terminal ) ) ;
82
84
socket . on ( 'data' , onData ( terminal ) ) ;
83
85
@@ -87,8 +89,8 @@ function createTerminal(terminalContainer, {env, command, autoRestart, socket, f
87
89
} ;
88
90
}
89
91
90
- function _onConnect ( socket , terminal , { env, cols, rows, command, autoRestart} ) {
91
- socket . emit ( 'terminal' , { env, cols, rows, command, autoRestart} ) ;
92
+ function _onConnect ( socket , terminal , { env, cwd , cols, rows, command, autoRestart} ) {
93
+ socket . emit ( 'terminal' , { env, cwd , cols, rows, command, autoRestart} ) ;
92
94
socket . emit ( 'resize' , { cols, rows} ) ;
93
95
terminal . fit ( ) ;
94
96
}
0 commit comments