Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Ruby 中,您可以使用Kernel.exec将当前执行的进程替换为触发的进程。
是否可以在 Go 中做同样的事情?
这相当于 Kernel.exec:
package main import "fmt" import "syscall" func main() { if err := syscall.Exec("/bin/ls", []string{"ls", "-l"}, []string{}); err != nil { fmt.Println(err) } }
但它不是便携式的。