File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/vs/workbench/contrib/terminal/browser Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -824,10 +824,29 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
824
824
}
825
825
826
826
async runCommand ( commandLine : string , shouldExecute : boolean ) : Promise < void > {
827
+ let commandDetection = this . capabilities . get ( TerminalCapability . CommandDetection ) ;
828
+
829
+ // Await command detection if the terminal is starting up
830
+ if ( ! commandDetection && ( this . _processManager . processState === ProcessState . Uninitialized || this . _processManager . processState === ProcessState . Launching ) ) {
831
+ const store = new DisposableStore ( ) ;
832
+ await Promise . race ( [
833
+ new Promise < void > ( r => {
834
+ store . add ( this . capabilities . onDidAddCapabilityType ( e => {
835
+ if ( e === TerminalCapability . CommandDetection ) {
836
+ commandDetection = this . capabilities . get ( TerminalCapability . CommandDetection ) ;
837
+ r ( ) ;
838
+ }
839
+ } ) ) ;
840
+ } ) ,
841
+ timeout ( 2000 ) ,
842
+ ] ) ;
843
+ store . dispose ( ) ;
844
+ }
845
+
827
846
// Determine whether to send ETX (ctrl+c) before running the command. This should always
828
847
// happen unless command detection can reliably say that a command is being entered and
829
848
// there is no content in the prompt
830
- if ( this . capabilities . get ( TerminalCapability . CommandDetection ) ?. hasInput !== false ) {
849
+ if ( commandDetection ?. hasInput !== false ) {
831
850
await this . sendText ( '\x03' , false ) ;
832
851
// Wait a little before running the command to avoid the sequences being echoed while the ^C
833
852
// is being evaluated
You can’t perform that action at this time.
0 commit comments