github.com/kayoticsully/syncthing@v0.8.9-0.20140724133906-c45a2fdc03f8/cmd/syncthing/openurl_unix.go (about)

     1  // Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file).
     2  // All rights reserved. Use of this source code is governed by an MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build !windows
     6  
     7  package main
     8  
     9  import (
    10  	"os/exec"
    11  	"runtime"
    12  	"syscall"
    13  )
    14  
    15  func openURL(url string) error {
    16  	switch runtime.GOOS {
    17  	case "darwin":
    18  		return exec.Command("open", url).Run()
    19  
    20  	default:
    21  		cmd := exec.Command("xdg-open", url)
    22  		cmd.SysProcAttr = &syscall.SysProcAttr{
    23  			Setpgid: true,
    24  		}
    25  		return cmd.Run()
    26  	}
    27  }