From fb8ff758f93af2d3e21d6f366c7bc4d5afd42f1c Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 19 Oct 2023 15:47:00 +0200
Subject: [PATCH] By default display preprocessor output line by line instead
 of only at the end

Allows judging how long individual steps take for big models
---
 matlab/dynare.m | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/matlab/dynare.m b/matlab/dynare.m
index c22a5f3c7e..b782210872 100644
--- a/matlab/dynare.m
+++ b/matlab/dynare.m
@@ -254,9 +254,15 @@ else
 end
 
 pTic = tic;
-[status, result] = system(command);
+if preprocessoroutput
+    status = system(command); %immediately flush output
+else
+    [status, result] = system(command); %save output for output in case of failure
+    if status ~= 0 || preprocessoroutput
+        disp(result)
+    end
+end
 if status ~= 0 || preprocessoroutput
-    disp(result)
     pToc = toc(pTic);
     dprintf('Preprocessing time: %s.', dynsec2hms(pToc))
     if nargout
-- 
GitLab