1// Copyright (C) 2014 The Syncthing Authors. 2// 3// This Source Code Form is subject to the terms of the Mozilla Public 4// License, v. 2.0. If a copy of the MPL was not distributed with this file, 5// You can obtain one at https://mozilla.org/MPL/2.0/. 6 7// +build !windows 8 9package main 10 11import ( 12 "os/exec" 13 "runtime" 14 "syscall" 15) 16 17func openURL(url string) error { 18 switch runtime.GOOS { 19 case "darwin": 20 return exec.Command("open", url).Run() 21 22 default: 23 cmd := exec.Command("xdg-open", url) 24 cmd.SysProcAttr = &syscall.SysProcAttr{ 25 Setpgid: true, 26 } 27 return cmd.Run() 28 } 29} 30