demo: osexec - todo

This commit is contained in:
xushiwei
2024-07-18 23:00:57 +08:00
parent 7232fc36ab
commit 2b3dafed61

18
_demo/osexec/exec.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import (
"os"
"os/exec"
"runtime"
)
func main() {
ls := "ls"
if runtime.GOOS == "windows" {
ls = "dir"
}
cmd := exec.Command(ls)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
}