Replace The Current Process With An External Command
Go's syscall.Exec
function can be used to execute an external program. Instead of forking a child process though, it runs the external command in place of the current process. You need to give the function three pieces of information: the location of the binary, the pieces of the command to be executed, and relevant environment. Here is a simple example.
When this program is executed, it will replace itself with a new tmux session named burrito.
Last updated