Files
llgo/_demo/cexec/exec.go

21 lines
306 B
Go
Raw Normal View History

2024-07-12 00:39:16 +08:00
package main
import (
"runtime"
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
)
func main() {
ls := c.Str("ls")
args := []*c.Char{ls, c.Str("-l"), nil}
if runtime.GOOS == "windows" {
ls = c.Str("dir")
args = []*c.Char{ls, nil}
}
os.Execvp(ls, unsafe.SliceData(args))
}