Date:2013-12-06 00:22:02 (10 years 3 months ago)
Author:Paul Cercueil
Commit:6ef3f3b1908733555b19b4a812584c1eca8c3143
Message:Redirect to log by redefining stdout and stderr

Files: src/linkapp.cpp (1 diff)

Change Details

src/linkapp.cpp
590590    string command = exec;
591591
592592    if (!params.empty()) command += " " + params;
593
594    if (gmenu2x->confInt["outputLogs"]
593595#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
594    if (gmenu2x->confInt["outputLogs"] && !consoleApp)
595        command += " &> " LOG_FILE;
596#else
597    if (gmenu2x->confInt["outputLogs"])
598        command += " &> " LOG_FILE;
596                && !consoleApp
599597#endif
598    ) {
599        int fd = open(LOG_FILE, O_WRONLY | O_TRUNC | O_CREAT, 0644);
600        if (fd < 0) {
601            ERROR("Unable to open log file for write: %s\n", LOG_FILE);
602        } else {
603            fflush(stdout);
604            dup2(fd, STDOUT_FILENO);
605            dup2(fd, STDERR_FILENO);
606            close(fd);
607        }
608    }
600609
601610    gmenu2x->saveSelection();
602611

Archive Download the corresponding diff file



interactive