|
26 | 26 | #include "menu.h" |
27 | 27 | #include "selector.h" |
28 | 28 | #include "messagebox.h" |
| 29 | +#include "terminaldialog.h" |
29 | 30 | #include "debug.h" |
30 | 31 |
|
31 | 32 | using namespace std; |
@@ -412,7 +413,9 @@ void LinkApp::launch(const string &selectedFile, string dir) { |
412 | 413 | } |
413 | 414 | } |
414 | 415 |
|
415 | | - INFO("Executing '%s' (%s %s)", title.c_str(), exec.c_str(), params.c_str()); |
| 416 | + string execcmd = exec + " " + params; |
| 417 | + |
| 418 | + INFO("Executing '%s' (%s)", title.c_str(), execcmd.c_str()); |
416 | 419 |
|
417 | 420 | #if defined(OPK_SUPPORT) |
418 | 421 | if (isOPK()) { |
@@ -478,28 +481,39 @@ void LinkApp::launch(const string &selectedFile, string dir) { |
478 | 481 | command = "HOME=" + params + " " + command; |
479 | 482 | } |
480 | 483 |
|
481 | | - gmenu2x->quit(false); |
482 | | - |
483 | | - if (getTerminal()) gmenu2x->enableTerminal(); |
484 | | - |
485 | | - // execle("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL, environ); |
486 | | - pid_t son = fork(); |
487 | | - if (!son) { |
488 | | - execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); |
489 | | - ERROR("execlp of shell cmd \"%s\" failed", command.c_str()); |
490 | | - } |
491 | | - int status; |
492 | | - waitpid(son, &status, 0); |
493 | | - INFO("Last launched app \"%s\" exited with status=%i", command.c_str(), status); |
494 | | - |
495 | | - if (gmenu2x->confInt["saveAutoStart"]) { |
496 | | - // gmenu2x->confStr["datetime"] = get_date_time(); |
497 | | - // gmenu2x->writeConfig(); |
498 | | - gmenu2x->shutdownOS(); |
499 | | - } else { |
500 | | - //we already called SDL_Quit try relaunching gmenu2x |
501 | | - chdir(exe_path().c_str()); |
502 | | - execlp("./gmenu2x", "./gmenu2x", NULL); // can't use gmenu2x->reinit() since we've called quit() |
| 484 | + if (getTerminal()) |
| 485 | +#if defined(CUS_TERM) |
| 486 | + gmenu2x->enableTerminal(); |
| 487 | +#else |
| 488 | + { |
| 489 | + chdir(exe_path().c_str()); // we're returrning to menu so change cur wdir back to gmenu2x |
| 490 | + TerminalDialog td(gmenu2x, this->getTitle().c_str(), execcmd, "icons/configure.png"); |
| 491 | + td.exec(command); |
| 492 | + gmenu2x->initMenu(); |
| 493 | + return; |
| 494 | + } else |
| 495 | +#endif |
| 496 | + { |
| 497 | + gmenu2x->quit(false); |
| 498 | + // execle("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL, environ); |
| 499 | + pid_t son = fork(); |
| 500 | + if (!son) { |
| 501 | + execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); |
| 502 | + ERROR("execlp of shell cmd \"%s\" failed", command.c_str()); |
| 503 | + } |
| 504 | + int status; |
| 505 | + waitpid(son, &status, 0); |
| 506 | + INFO("Last launched app \"%s\" exited with status=%i", command.c_str(), status); |
| 507 | + |
| 508 | + if (gmenu2x->confInt["saveAutoStart"]) { |
| 509 | + // gmenu2x->confStr["datetime"] = get_date_time(); |
| 510 | + // gmenu2x->writeConfig(); |
| 511 | + gmenu2x->shutdownOS(); |
| 512 | + } else { |
| 513 | + //we already called SDL_Quit try relaunching gmenu2x |
| 514 | + chdir(exe_path().c_str()); |
| 515 | + execlp("./gmenu2x", "./gmenu2x", NULL); // can't use gmenu2x->reinit() since we've called quit() |
| 516 | + } |
503 | 517 | } |
504 | 518 | } |
505 | 519 |
|
|
0 commit comments