Skip to content

Commit eeabc6b

Browse files
authored
Merge pull request #534 from xushiwei/q
demo: osexec - todo
2 parents 7232fc3 + 2b3dafe commit eeabc6b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

_demo/osexec/exec.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"os/exec"
6+
"runtime"
7+
)
8+
9+
func main() {
10+
ls := "ls"
11+
if runtime.GOOS == "windows" {
12+
ls = "dir"
13+
}
14+
cmd := exec.Command(ls)
15+
cmd.Stdout = os.Stdout
16+
cmd.Stderr = os.Stderr
17+
cmd.Run()
18+
}

0 commit comments

Comments
 (0)