index work
This commit is contained in:
20
062-execing-processes/execing-processes.go
Normal file
20
062-execing-processes/execing-processes.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// ## Exec'ing Processes
|
||||
|
||||
package main
|
||||
|
||||
import "syscall"
|
||||
import "os"
|
||||
import "os/exec"
|
||||
|
||||
func main() {
|
||||
binary, lookErr := exec.LookPath("ls")
|
||||
if lookErr != nil {
|
||||
panic(lookErr)
|
||||
}
|
||||
execErr := syscall.Exec(binary, []string{"-a", "-l", "-h"}, os.Environ())
|
||||
if execErr != nil {
|
||||
panic(execErr)
|
||||
}
|
||||
}
|
||||
|
||||
// todo: note lack of fork
|
||||
Reference in New Issue
Block a user