I am executing the following golang program (snippet) with root privilege:
binary, lookErr := exec.LookPath("auditctl")
if lookErr != nil {
panic(lookErr)
}
env := os.Environ()
args := []string{"auditctl", "-D"}
execErr := syscall.Exec(binary, args, env)
if execErr != nil {
fmt.Println("error")
panic(execErr)
}
fmt.Println("no error")
Because I dont have any auditctl rules in the system, the command print the following in the terminal. This is all normal just like when I type in the shell directly.
No rules
Except that neither "error" nor "no error" are printed. Which means the golang program terminates right after syscall.Exec. How did this happen and how can I continue execution after syscall.Exec because I have other things to run within the same program.