File tree 1 file changed +21
-15
lines changed
src/client/terminals/envCollectionActivation
1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -52,24 +52,30 @@ export class ShellIntegrationService implements IShellIntegrationService {
52
52
const deferred = createDeferred < void > ( ) ;
53
53
const timestamp = new Date ( ) . getTime ( ) ;
54
54
const name = `Python ${ timestamp } ` ;
55
- const onDidExecuteTerminalCommand = this . appShell . onDidExecuteTerminalCommand ?. bind ( this . appShell ) ;
55
+ const { onDidExecuteTerminalCommand } = this . appShell ;
56
56
if ( ! onDidExecuteTerminalCommand ) {
57
57
// Proposed API is not available, assume shell integration is working at this point.
58
58
return true ;
59
59
}
60
- const disposable = onDidExecuteTerminalCommand ( ( e ) => {
61
- if ( e . terminal . name === name ) {
62
- deferred . resolve ( ) ;
63
- }
64
- } ) ;
65
- const terminal = this . terminalManager . createTerminal ( {
66
- name,
67
- shellPath : shell ,
68
- hideFromUser : true ,
69
- } ) ;
70
- terminal . sendText ( `echo ${ shell } ` ) ;
71
- const success = await Promise . race ( [ sleep ( 3000 ) . then ( ( ) => false ) , deferred . promise . then ( ( ) => true ) ] ) ;
72
- disposable . dispose ( ) ;
73
- return success ;
60
+ try {
61
+ const disposable = onDidExecuteTerminalCommand ( ( e ) => {
62
+ if ( e . terminal . name === name ) {
63
+ deferred . resolve ( ) ;
64
+ }
65
+ } ) ;
66
+ const terminal = this . terminalManager . createTerminal ( {
67
+ name,
68
+ shellPath : shell ,
69
+ hideFromUser : true ,
70
+ } ) ;
71
+ terminal . sendText ( `echo ${ shell } ` ) ;
72
+ const success = await Promise . race ( [ sleep ( 3000 ) . then ( ( ) => false ) , deferred . promise . then ( ( ) => true ) ] ) ;
73
+ disposable . dispose ( ) ;
74
+ return success ;
75
+ } catch ( ex ) {
76
+ traceError ( `Failed to subscribe to onDidExecuteTerminalCommand` , ex ) ;
77
+ // Proposed API is not available, assume shell integration is working at this point.
78
+ return true ;
79
+ }
74
80
}
75
81
}
You can’t perform that action at this time.
0 commit comments