66//!
77//! * macos => default, as well as browsers listed under [Browser](enum.Browser.html)
88//! * windows => default browser only
9- //! * linux => default browser only (uses $BROWSER env var, failing back to xdg-open, gvfs-open and
9+ //! * linux or *bsd => default browser only (uses $BROWSER env var, failing back to xdg-open, gvfs-open and
1010//! gnome-open, in that order)
1111//! * android => not supported right now
1212//! * ios => not supported right now
@@ -235,13 +235,18 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> {
235235 }
236236}
237237
238- /// Deal with opening of browsers on Linux - currently supports only the default browser
238+ /// Deal with opening of browsers on Linux and *BSD - currently supports only the default browser
239239///
240240/// The mechanism of opening the default browser is as follows:
241241/// 1. Attempt to use $BROWSER env var if available
242242/// 2. Attempt to open the url via xdg-open, gvfs-open, gnome-open, respectively, whichever works
243243/// first
244- #[ cfg( target_os = "linux" ) ]
244+ #[ cfg( any(
245+ target_os = "linux" ,
246+ target_os = "freebsd" ,
247+ target_os = "netbsd" ,
248+ target_os = "openbsd"
249+ ) ) ]
245250#[ inline]
246251fn open_browser_internal ( browser : Browser , url : & str ) -> Result < Output > {
247252 match browser {
@@ -255,9 +260,12 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> {
255260 ) ) ,
256261 }
257262}
258-
259- /// Open on Linux using the $BROWSER env var
260- #[ cfg( target_os = "linux" ) ]
263+ #[ cfg( any(
264+ target_os = "linux" ,
265+ target_os = "freebsd" ,
266+ target_os = "netbsd" ,
267+ target_os = "openbsd"
268+ ) ) ]
261269fn open_on_linux_using_browser_env ( url : & str ) -> Result < Output > {
262270 let browsers = :: std:: env:: var ( "BROWSER" )
263271 . map_err ( |_| -> Error { Error :: new ( ErrorKind :: NotFound , "BROWSER env not set" ) } ) ?;
@@ -290,8 +298,15 @@ fn open_on_linux_using_browser_env(url: &str) -> Result<Output> {
290298 ) )
291299}
292300
293- #[ cfg( not( any( target_os = "windows" , target_os = "macos" , target_os = "linux" ) ) ) ]
294- compile_error ! ( "Only Windows, Mac OS and Linux are currently supported" ) ;
301+ #[ cfg( not( any(
302+ target_os = "windows" ,
303+ target_os = "macos" ,
304+ target_os = "linux" ,
305+ target_os = "freebsd" ,
306+ target_os = "netbsd" ,
307+ target_os = "openbsd"
308+ ) ) ) ]
309+ compile_error ! ( "Only Windows, Mac OS, Linux and *BSD are currently supported" ) ;
295310
296311#[ test]
297312fn test_open_default ( ) {
0 commit comments