Skip to content

Commit 364d038

Browse files
committed
run_cmdstan logic fix
1 parent d16271a commit 364d038

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cmdstanpy/model.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,9 +1306,9 @@ def _run_cmdstan(
13061306
line = proc.stdout.readline()
13071307
fd_out.write(line)
13081308
line = line.strip()
1309-
if show_console and len(line) > 1:
1309+
if show_console:
13101310
print('chain {}: {}'.format(idx + 1, line))
1311-
if show_progress and progress_hook is not None:
1311+
elif show_progress and progress_hook is not None:
13121312
progress_hook(line)
13131313
if show_progress and progress_hook is not None:
13141314
progress_hook("Done")
@@ -1317,7 +1317,9 @@ def _run_cmdstan(
13171317
if stdout:
13181318
fd_out.write(stdout)
13191319
if show_console:
1320-
print('chain {}: {}'.format(idx + 1, stdout))
1320+
lines = stdout.split('\n')
1321+
for line in lines:
1322+
print('chain {}: {}'.format(idx + 1, stdout))
13211323

13221324
fd_out.close()
13231325
except OSError as e:

0 commit comments

Comments
 (0)