2222#include " ../RetroFE.h"
2323#include " ../SDL.h"
2424#include < cstdlib>
25+ #include < sys/types.h>
26+ #include < unistd.h>
2527#include < locale>
2628#include < sstream>
2729#include < fstream>
@@ -44,6 +46,7 @@ bool Launcher::run(std::string collection, Item *collectionItem)
4446 std::string extensionstr;
4547 std::string matchedExtension;
4648 std::string args;
49+ bool res = true ;
4750
4851 std::string launcherFile = Utils::combinePath ( Configuration::absolutePath, " collections" , collectionItem->collectionInfo ->name , " launchers" , collectionItem->name + " .conf" );
4952 std::ifstream launcherStream ( launcherFile.c_str ( ) );
@@ -119,23 +122,15 @@ bool Launcher::run(std::string collection, Item *collectionItem)
119122 if (!execute (executablePath, args, currentDirectory))
120123 {
121124 Logger::write (Logger::ZONE_ERROR, " Launcher" , " Failed to launch." );
122-
123- // / Clean VT
124- int current_VT = Utils::getVTid ();
125- if (current_VT >= 0 ){
126- printf (" ERROR Cleaning VT %d\n " , current_VT);
127- Utils::termfix (current_VT);
128- }
129- else {
130- for (int i=0 ; i<=12 ; i++){
131- Utils::termfix (i);
132- }
133- }
134-
135- return false ;
125+ res = false ;
136126 }
137127
138- // / Clean VT
128+ /* Restore stored PID */
129+ char shellCmd[20 ];
130+ sprintf (shellCmd, " %s %d" , SHELL_CMD_RECORD_PID, getpid ());
131+ Utils::executeRawPath ((const char *)shellCmd);
132+
133+ /* Clean VT */
139134 int current_VT = Utils::getVTid ();
140135 if (current_VT >= 0 ){
141136 printf (" Cleaning VT %d\n " , current_VT);
@@ -147,7 +142,7 @@ bool Launcher::run(std::string collection, Item *collectionItem)
147142 }
148143 }
149144
150- return true ;
145+ return res ;
151146}
152147
153148std::string Launcher::replaceVariables (std::string str,
0 commit comments