blob: 4565d5929d41ae2d664ede9b6f0ba41819de15d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// +build !windows
package browserenv
import (
"fmt"
"os"
)
// shell returns the current shell specified by the SHELL environment variable
// along with a "-c" argument. If SHELL is undefined, `/bin/sh` is used.
func shell() (args []string) {
shell := os.Getenv("SHELL")
if shell == "" {
shell = "/bin/sh"
}
return []string{shell, "-c"}
}
// shellEscapeCommand formats a browser command with url, escaping url by
// wrapping it in single quotes.
func shellEscapeCommand(browser, url string) string {
return fmt.Sprintf("%s '%s'", browser, url)
}
|