From: c vw <dl1ycf@darc.de>
Date: Fri, 14 Aug 2020 08:43:18 +0000 (+0200)
Subject: Re-direct stdout and stderr to current work dir files
X-Git-Url: https://git.rkrishnan.org/pf/frontends/provisioning?a=commitdiff_plain;h=e56e5dcaa6eea4d43e7c87d29ec3b8cbf1187a29;p=pihpsdr.git

Re-direct stdout and stderr to current work dir files
---

diff --git a/MacOS.c b/MacOS.c
index 55e4176..ec095ae 100644
--- 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