File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/interceptors/terminal Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,9 @@ const getXTerminalCommand = async (command = 'x-terminal-emulator'): Promise<Spa
116116 // any of the args we want to use. To fix this, we parse --help to try and detect the underlying
117117 // terminal, and run it directly with the args we need.
118118 try {
119- const { stdout } = await execAsync ( `${ command } --help` ) ; // debian wrapper ignores --version
119+ // Run the command with -h to get some output we can use to infer the terminal itself.
120+ // --version would be nice, but the debian wrapper ignores it. --help isn't supported by xterm.
121+ const { stdout } = await execAsync ( `${ command } -h` ) ;
120122 const helpOutput = stdout . toLowerCase ( ) . replace ( / [ ^ \w \d ] + / g, ' ' ) ;
121123
122124 if ( helpOutput . includes ( 'gnome terminal' ) && await commandExists ( 'gnome-terminal' ) ) {
@@ -127,7 +129,12 @@ const getXTerminalCommand = async (command = 'x-terminal-emulator'): Promise<Spa
127129 return getKonsoleTerminalCommand ( ) ;
128130 }
129131 } catch ( e ) {
130- reportError ( e ) ;
132+ if ( e . message . includes ( 'rxvt' ) ) {
133+ // Bizarrely, rxvt -h prints help but always returns a non-zero exit code.
134+ // Doesn't need any special arguments anyway though, so just ignore it
135+ } else {
136+ reportError ( e ) ;
137+ }
131138 }
132139
133140 // If there's an error, or we just don't recognize the console, give up & run it directly
You can’t perform that action at this time.
0 commit comments