]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Re-direct stdout and stderr to current work dir files
authorc vw <dl1ycf@darc.de>
Fri, 14 Aug 2020 08:43:18 +0000 (10:43 +0200)
committerc vw <dl1ycf@darc.de>
Fri, 14 Aug 2020 08:43:18 +0000 (10:43 +0200)
MacOS.c

diff --git a/MacOS.c b/MacOS.c
index 55e41769039dd789e31b9961bcae9708cfed617e..ec095ae1f784953add73a9ecc8d9b8ce7b2948f2 100644 (file)
--- a/MacOS.c
+++ b/MacOS.c
@@ -94,10 +94,16 @@ void MacOSstartup(char *path) {
 //  chdir to the work dir
 //
     chdir(workdir);
-    c=getcwd(workdir,sizeof(workdir));
+//
+//  Make two local files for stdout and stderr, to allow
+//  post-mortem debugging
+//
+    (void) freopen("pihpsdr.stdout", "w", stdout);
+    (void) freopen("pihpsdr.stderr", "w", stderr);
 //
 //  Copy icon from app bundle to the work dir
 //
+    c=getcwd(workdir,sizeof(workdir));
     if (strlen(path) < 1024) {
       //
       // source = basename of the executable