mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-02-18 08:54:42 +02:00
Fix problems with missing tty for launched applications
This commit is contained in:
parent
6773ad7d3a
commit
dd0709e1da
@ -19,6 +19,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -492,6 +493,15 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
if((backlight() != 0) && (backlight() != gmenu2x->confInt["backlight"]))
|
if((backlight() != 0) && (backlight() != gmenu2x->confInt["backlight"]))
|
||||||
gmenu2x->setBacklight(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);
|
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
|
//if execution continues then something went wrong and as we already called SDL_Quit we cannot continue
|
||||||
//try relaunching gmenu2x
|
//try relaunching gmenu2x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user