File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/client/common/terminal Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,14 @@ export class TerminalService implements ITerminalService, Disposable {
8181 commandLine : string ,
8282 isPythonShell : boolean ,
8383 ) : Promise < TerminalShellExecution | undefined > {
84- const terminal = this . terminal ! ;
84+ // TODO: First execution of shift+enter may get ignored when using sendText.
85+ // Prevent Cannot read properties of undefined: https://github.com/microsoft/vscode-python-environments/issues/958
86+ if ( ! this . terminal ) {
87+ traceVerbose ( 'Terminal not available yet, cannot execute command' ) ;
88+ return undefined ;
89+ }
90+
91+ const terminal = this . terminal ;
8592 if ( ! this . options ?. hideFromUser ) {
8693 terminal . show ( true ) ;
8794 }
@@ -138,6 +145,7 @@ export class TerminalService implements ITerminalService, Disposable {
138145 name : this . options ?. title || 'Python' ,
139146 hideFromUser : this . options ?. hideFromUser ,
140147 } ) ;
148+ return ;
141149 } else {
142150 this . terminalShellType = this . terminalHelper . identifyTerminalShell ( this . terminal ) ;
143151 this . terminal = this . terminalManager . createTerminal ( {
You can’t perform that action at this time.
0 commit comments