Commit 72c40f4
committed
python: OutputFormat: run pre() only after line is printed
Problem: The `pre` argument to OutputFormat.print_items() is
documented as being called before printing each line, but it is
called even if an empty line is generated. This can cause problems
in tools like flux-jobs(1) which uses a pre() function to colorize
lines of output. If a color is set, but the line is then skipped
or an exception is thrown, the terminal may be left with the line
color enabled.
Fix OutputFormat.print_items() to call the pre() function after the
line has been formatted, just before printing it. This removes the
possibility that pre() will be called without post() due to an empty
line or an exception during line formatting.
Fixes #52091 parent c2964c9 commit 72c40f4
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
699 | | - | |
700 | | - | |
701 | 699 | | |
702 | 700 | | |
703 | 701 | | |
| 702 | + | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| |||
0 commit comments