Skip to content

Commit 3c72c25

Browse files
committed
system instead of pclose
1 parent ec08845 commit 3c72c25

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

RetroFE/Source/Execute/Launcher.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ bool Launcher::run(std::string collection, Item *collectionItem)
133133
printf("Applying keymap file cmd: \"%s\"\n", cmd.c_str());
134134

135135
/* Launch shell cmd */
136-
fp = popen(cmd.c_str(), "r");
137-
if (fp != NULL) {
138-
pclose(fp);
139-
}
136+
system(cmd.c_str());
140137
}
141138

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

154151
/* Launch shell cmd */
155-
fp = popen(cmd.c_str(), "r");
156-
if (fp != NULL) {
157-
pclose(fp);
158-
}
152+
system(cmd.c_str());
159153
}
160154

161155
/* Restart audio amp */
162-
fp = popen(SHELL_CMD_TURN_AMPLI_ON, "r");
163-
if (fp != NULL) {
164-
pclose(fp);
165-
}
156+
system(SHELL_CMD_TURN_AMPLI_ON);
166157

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

174165
/* Stop audio amp */
175-
fp = popen(SHELL_CMD_TURN_AMPLI_OFF, "r");
176-
if (fp != NULL) {
177-
pclose(fp);
178-
}
166+
system(SHELL_CMD_TURN_AMPLI_OFF);
179167

180168
/* Reset default key mapping */
181-
fp = popen(SHELL_CMD_MAPPING_RESET, "r");
182-
if (fp != NULL) {
183-
pclose(fp);
184-
}
169+
system(SHELL_CMD_MAPPING_RESET);
185170

186171
/* Restore stored PID */
187172
char shellCmd[20];

0 commit comments

Comments
 (0)