diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 2e3edf6..2cdcd10 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include #include +#include #include #include @@ -492,6 +493,15 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) { if((backlight() != 0) && (backlight() != gmenu2x->confInt["backlight"])) gmenu2x->setBacklight(backlight()); + /* Make the terminal we're connected to (via stdin/stdout) our + contolling terminal again. Else many console programs are + not going to work correctly. Actually this would not be + necessary, if SDL correctly restored terminal state after + SDL_Quit(). */ + int pid = setsid(); + tcsetpgrp(1, pid); + ioctl(1, TIOCSCTTY, (char *)1); + execlp("/bin/sh","/bin/sh","-c",command.c_str(),NULL); //if execution continues then something went wrong and as we already called SDL_Quit we cannot continue //try relaunching gmenu2x