[opensuse-buildservice] osc flushing stdout

Is there a way to force osc to keep flushing stdout, even if it thinks output is not to a terminal? I need to log osc operations that I've been doing so I can see again later who I got into a certain state. Years ago I wrote a wrapper script for such purpose. It basically is <cmd> | tee -a, and I don't know how else to divert program output into a log file. Unfortunately the piping makes osc think it is no longer outputting stdout to a terminal, buffering large chunks first script is not suitable in many ways, one of them being the unreadable output it creates. Thanks, Volker -- Volker Kuhlmann http://volker.top.geek.nz/ Please do not CC list postings to me. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

Volker Kuhlmann <list0570@paradise.net.nz> writes:
script is not suitable in many ways, one of them being the unreadable output it creates.
In which way is it unreadable? Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thu 07 May 2015 19:17:23 NZST +1200, Andreas Schwab wrote:
Volker Kuhlmann <list0570@paradise.net.nz> writes:
script is not suitable in many ways, one of them being the unreadable output it creates.
In which way is it unreadable?
Too much escape sequence and shell crud, I'm only interested in the command output. Plus a wrapper script gives me the choice over what I log and what's just fluff. Thanks, Volker -- Volker Kuhlmann http://volker.top.geek.nz/ Please do not CC list postings to me. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

Volker Kuhlmann <list0570@paradise.net.nz> writes:
I'm only interested in the command output.
RTFM. -c, --command command Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thu 07 May 2015 20:14:34 NZST +1200, Andreas Schwab wrote:
-c, --command command
Ok, but what happens if osc decides to ask for user input? I meant I want the command IO, not the shell stuff between commands. And not of all commands I run either. script doesn't really work the same as copying the screen output of a command to file while keeping stdin functional. Thanks, Volker -- Volker Kuhlmann http://volker.top.geek.nz/ Please do not CC list postings to me. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thursday 07 May 2015, Volker Kuhlmann wrote:
On Thu 07 May 2015 20:14:34 NZST +1200, Andreas Schwab wrote:
-c, --command command
Ok, but what happens if osc decides to ask for user input? I meant I want the command IO, not the shell stuff between commands. And not of all commands I run either. script doesn't really work the same as copying the screen output of a command to file while keeping stdin functional.
Yes it should flush newlines always. For me this example is most annoying: $ osc bl ... | less It takes ages until you see something ... specially if you follow a running build. cu, Rudi -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

Volker Kuhlmann <list0570@paradise.net.nz> writes:
On Thu 07 May 2015 20:14:34 NZST +1200, Andreas Schwab wrote:
-c, --command command
Ok, but what happens if osc decides to ask for user input?
script works just like your terminal, providing an interface via a pty, but additionally logging everything. Whether the command is run via an interactive shell or directly is irrelevant. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Wed, May 6, 2015 at 10:18 PM, Volker Kuhlmann <list0570@paradise.net.nz> wrote:
Is there a way to force osc to keep flushing stdout, even if it thinks output is not to a terminal?
Does this work: stdbuf --output=0 osc .... > output-log Greg -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Fri 08 May 2015 03:44:57 NZST +1200, Greg Freemyer wrote:
Is there a way to force osc to keep flushing stdout, even if it thinks output is not to a terminal?
Does this work:
stdbuf --output=0 osc .... > output-log
It does indeed! -oL is sufficient, but I havent' checked with prompts yet. Very useful command I didn't know existed. Rüdiger's example is another case where no line buffering is problematic, never mond prompting for user input on a blank screen. https://bugzilla.novell.com/show_bug.cgi?id=930137 Thanks very much, Volker -- Volker Kuhlmann http://volker.top.geek.nz/ Please do not CC list postings to me. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On 2015-05-08 10:06:09 +1200, Volker Kuhlmann wrote:
On Fri 08 May 2015 03:44:57 NZST +1200, Greg Freemyer wrote:
Is there a way to force osc to keep flushing stdout, even if it thinks output is not to a terminal?
Does this work:
stdbuf --output=0 osc .... > output-log
It does indeed! -oL is sufficient, but I havent' checked with prompts yet. Very useful command I didn't know existed.
Rüdiger's example is another case where no line buffering is problematic, never mond prompting for user input on a blank screen.
Thanks for the report - it's fixed in the meantime. (see commits 22b272f3afc1a3f3b83b764b7745a662bc0aa234 and 56a9ab60dc77f5dcbf1b29b7846c09f8d80c138c) Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (5)
-
Andreas Schwab
-
Greg Freemyer
-
Marcus Hüwe
-
Ruediger Meier
-
Volker Kuhlmann