File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,12 @@ pub fn open_browser(path: &Path) -> io::Result<bool> {
364
364
#[ cfg( not( windows) ) ]
365
365
fn inner ( path : & Path ) -> io:: Result < bool > {
366
366
use std:: process:: Stdio ;
367
+ use std:: env;
368
+
369
+ let env_browser = env:: var_os ( "BROWSER" ) . map ( |b| env:: split_paths ( & b) . collect :: < Vec < _ > > ( ) ) ;
370
+ let env_commands = env_browser. as_ref ( )
371
+ . map ( |cmds| cmds. iter ( ) . by_ref ( ) . filter_map ( |b| b. to_str ( ) ) . collect ( ) )
372
+ . unwrap_or ( vec ! [ ] ) ;
367
373
368
374
let commands = [
369
375
"xdg-open" ,
@@ -372,7 +378,7 @@ pub fn open_browser(path: &Path) -> io::Result<bool> {
372
378
"chromium" ,
373
379
"sensible-browser" ,
374
380
] ;
375
- if let Some ( cmd) = find_cmd ( & commands) {
381
+ if let Some ( cmd) = find_cmd ( & env_commands ) . or ( find_cmd ( & commands) ) {
376
382
Command :: new ( cmd)
377
383
. arg ( path)
378
384
. stdin ( Stdio :: null ( ) )
You can’t perform that action at this time.
0 commit comments