I want to run an interactive shell script in golang program, such as wrap a "ping 8.8.8.8", "python", "bc", "mysql -H -P -u -p". The golang program should exit when itself finish calling an interactive command,or shell, and leaving spawned interactive with user.
I have tried the "exec.Command("python").Run()", but the golang program just finish and leave nothing to me.
func (h ConnectHandler)ConnectMySQL() {
logrus.Debug("ConnectMySQL, script:",common.CONF.FilePath.MySQLConnectScriptPath)
err :=exec.Command("bash",common.CONF.FilePath.MySQLConnectScriptPath).Run()
if err != nil{
logrus.Errorf("ConnectMySQL failed, exit 1,%s",err)
os.Exit(1)
}
}