Home > Software engineering >  Starting a program in screen (linux) using golang
Starting a program in screen (linux) using golang

Time:11-29

I want to start a .exe file in linux inside a golang project using os/exec library.
I usually use "mono" to start .exe file so i did:

command := make([]string, 7)
command = {"screen", "-S", screenName, "-d", "-m", "mono", exeFile}
cmd := exec.Command(command[0], command[1:]...)
cmd.Dir = "ConsoleClient"
_, err := cmd.Output() //*

I cant run this and i tried also with cmd.Run() or cmd.Start()

*With cmd.Start() (for me the best way) i don't see any error but at the end screen isn't created

It failed also adding ^M at the end of my command

CodePudding user response:

Try this at line 2:

command = {"screen", "-dmS", screenName, "mono", exeFile}

parameters should be before the screen name.

  • Related