Bug 317 - When stdout of slonik is not a terminal it is fully buffered
Summary: When stdout of slonik is not a terminal it is fully buffered
Status: ASSIGNED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: slonik (show other bugs)
Version: devel
Hardware: All All
: low enhancement
Assignee: Jan Wieck
URL: https://github.com/wieck/slony1-engin...
Depends on:
Blocks:
 
Reported: 2013-10-14 10:57 UTC by Jan Wieck
Modified: 2013-10-15 14:01 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Wieck 2013-10-14 10:57:50 UTC
Slonik uses both, stdout and stderr. When stdout is not a terminal, it becomes fully buffered by default. If slonik dies with a crash, the last of stdout may be lost in this case. Also if stdout and stderr are combined at a higher level, messages can appear out of order.

I propose to call setlinebuf(3) on stdout at the start of slonik.

I further propose to move all output to stdout. That includes implementing a notice processor that will use the same output function that adds the script position to other messages.
Comment 1 Jan Wieck 2013-10-15 14:01:42 UTC
Here are the proposed changes:
https://github.com/wieck/slony1-engine/commit/fc8c985e70e5715122953d1a4da802721d17272e