@@ -12,7 +12,7 @@ const findOsxExecutable = util.promisify(findOsxExecutableCb);
1212
1313import { Interceptor } from '..' ;
1414import { HtkConfig } from '../../config' ;
15- import { reportError } from '../../error-tracking' ;
15+ import { reportError , addBreadcrumb } from '../../error-tracking' ;
1616import { OVERRIDE_BIN_PATH , getTerminalEnvVars } from './terminal-env-overrides' ;
1717
1818const checkAccess = util . promisify ( fs . access ) ;
@@ -58,10 +58,19 @@ const spawnAndCollectOutput = (command: string, args: string[] = []): Promise<{
5858} ;
5959
6060const getTerminalCommand = _ . memoize ( async ( ) : Promise < SpawnArgs | null > => {
61- if ( process . platform === 'win32' ) return getWindowsTerminalCommand ( ) ;
62- else if ( process . platform === 'darwin' ) return getOSXTerminalCommand ( ) ;
63- else if ( process . platform === 'linux' ) return getLinuxTerminalCommand ( ) ;
64- else return null ;
61+ let result : Promise < SpawnArgs | null > ;
62+
63+ if ( process . platform === 'win32' ) result = getWindowsTerminalCommand ( ) ;
64+ else if ( process . platform === 'darwin' ) result = getOSXTerminalCommand ( ) ;
65+ else if ( process . platform === 'linux' ) result = getLinuxTerminalCommand ( ) ;
66+ else result = Promise . resolve ( null ) ;
67+
68+ result . then ( ( terminal ) => {
69+ if ( terminal ) addBreadcrumb ( 'Found terminal' , { data : { terminal } } ) ;
70+ else reportError ( 'No terminal could be detected' ) ;
71+ } ) ;
72+
73+ return result ;
6574} ) ;
6675
6776const getWindowsTerminalCommand = async ( ) : Promise < SpawnArgs | null > => {
@@ -367,11 +376,6 @@ const resetShellStartupScripts = () => {
367376
368377const terminals : _ . Dictionary < ChildProcess [ ] | undefined > = { }
369378
370- // Memoize this report: i.e. send it only once
371- const reportNoTerminal = _ . memoize ( ( ) => {
372- reportError ( 'No terminal could be detected' ) ;
373- } ) ;
374-
375379export class TerminalInterceptor implements Interceptor {
376380
377381 id = 'fresh-terminal' ;
@@ -380,9 +384,7 @@ export class TerminalInterceptor implements Interceptor {
380384 constructor ( private config : HtkConfig ) { }
381385
382386 async isActivable ( ) : Promise < boolean > {
383- const terminalAvailable = ! ! ( await getTerminalCommand ( ) ) ;
384- if ( ! terminalAvailable ) reportNoTerminal ( ) ;
385- return terminalAvailable ;
387+ return ! ! ( await getTerminalCommand ( ) ) ;
386388 }
387389
388390 isActive ( proxyPort : number | string ) : boolean {
0 commit comments