Mailinglist Archive: opensuse-buildservice (170 mails)

< Previous Next >
Re: [opensuse-buildservice] [PATCH0/0] raw_input checks if stdin is tty
On Sun, Nov 04, 2012 at 10:28:41PM +0100, Marcus Hüwe wrote:
Hi Michal,

On 2012-10-31 11:21:41 +0100, Michal Vyskocil wrote:
The biggest problem during usage and testing of a remote build feature is
the
fact osc asks user several times for the input. In this case, remote process
simply hangs and waits for the response, which is not even displayed,
because
of stdout buffering.

In this case ssh should be invoked with the "-t" parameter.

Corret, I'll update my --host patch instead


The samy apply for non-interactive usage - if osc is
called from a script, then it hangs waiting on something on stdin, which
will
never come.

Therefor I've added a simple check os.isatty(sys.stdin.fileno()) to the
osc.core.raw_input() - in case it's not terminal, the new RawInputError is
raised. It will show-up the question on stderr and program will be
terminated.

We could add something like a "--script-mode" (config) option. If
"osc --script-mode <cmd>" is invoked and <cmd> requires a user input an
exception is raised.

What do you think?

To be honest, I'd not invest a lot of effort in osc (1.x). Having a
reliable scripting mode (IOW not wait on stdin, provide reasonalbe
return codes, ...) can be a nice enhancenment of osc2, can't it?

Regards
Michal Vyskocil
< Previous Next >
References