Skip to content

Commit

Permalink
system instead of pclose
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-FK committed Apr 20, 2021
1 parent ec08845 commit 3c72c25
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions RetroFE/Source/Execute/Launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ bool Launcher::run(std::string collection, Item *collectionItem)
printf("Applying keymap file cmd: \"%s\"\n", cmd.c_str());

/* Launch shell cmd */
fp = popen(cmd.c_str(), "r");
if (fp != NULL) {
pclose(fp);
}
system(cmd.c_str());
}

/* Apply specific key mapping for selected item if found */
Expand All @@ -152,17 +149,11 @@ bool Launcher::run(std::string collection, Item *collectionItem)
printf("Applying keymap file cmd: \"%s\"\n", cmd.c_str());

/* Launch shell cmd */
fp = popen(cmd.c_str(), "r");
if (fp != NULL) {
pclose(fp);
}
system(cmd.c_str());
}

/* Restart audio amp */
fp = popen(SHELL_CMD_TURN_AMPLI_ON, "r");
if (fp != NULL) {
pclose(fp);
}
system(SHELL_CMD_TURN_AMPLI_ON);

/* Execute game */
if(!execute(executablePath, args, currentDirectory))
Expand All @@ -172,16 +163,10 @@ bool Launcher::run(std::string collection, Item *collectionItem)
}

/* Stop audio amp */
fp = popen(SHELL_CMD_TURN_AMPLI_OFF, "r");
if (fp != NULL) {
pclose(fp);
}
system(SHELL_CMD_TURN_AMPLI_OFF);

/* Reset default key mapping */
fp = popen(SHELL_CMD_MAPPING_RESET, "r");
if (fp != NULL) {
pclose(fp);
}
system(SHELL_CMD_MAPPING_RESET);

/* Restore stored PID */
char shellCmd[20];
Expand Down

0 comments on commit 3c72c25

Please sign in to comment.