...

/

Starting an External Command or Program

Starting an External Command or Program

This lesson provides an explanation about how to restart a program externally in case of a panic.

The os package contains the function StartProcess to call or start external OS commands or binary executables; its 1st argument is the process to be executed, the 2nd can be used to pass some options or arguments, and the 3rd is a struct that contains basic info about the OS-environment. It returns a pointer to the started process, or an error if it failed.

The exec package contains the structures and functions to accomplish the same task more easily; most important are exec.Command(name string, arg ...string) and Run(). The function ...