gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] tla & user interactivity


From: David Allouche
Subject: Re: [Gnu-arch-users] tla & user interactivity
Date: Wed, 24 Mar 2004 12:03:55 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

On Fri, Mar 19, 2004 at 09:34:06AM -0500, Aaron Bentley wrote:
> Hi all,
> 
> I've been writing a mini tla-colorizer.  This works fine for 
> non-interactive commands, and works quite badly for interactive ones.
> 
> So far, commit is the only potentially-interactive command in tla that 
> I'm aware of.  It invokes $EDITOR if there's no log, and vim sure 
> doesn't like being invoked with a pipe as its stdout.
> 
> The interativity of commit can be prevented by unsetting $EDITOR.  Are 
> there other interactive tla commands commands I should be aware of?

Virtually all commands which access archives can end up being
interactive: ssh or gpg asking for a password/passphrase, though that
would probably not be a problem in your case.

That, and the fact that piping w/o merging stdout and stderr may cause
messages to be printed on the user terminal in the wrong order, because
of buffering in the pipe, which is impossible by design to work around.
However, whether that can be a problem practically remains to be seen.

If you are bound to implement this colorization feature the Right Way, I
believe it would be necessary for tla to provide a hook. For example,
it could check for a TLA_COLORIZER environment variable, the name of the
colorizer executable, and use it as a coprocess to filter its output, to
the exclusion of the output of sub-process (authentication) and allowing
proper stream merging with dup2(2).

Some additional protocol could be used to colorize stdout and stderr
differently while preserving synchronization. I am not sure what is the
best way to do it, but you could just pipe everything through the
colorizer stdin (for synchronization) and use one control char to toggle
a bit between stdout/stderr (for different colorization and demuxing).

But if you are in Worse is Better mode, please just disregard this
message entirely.

-- 
                                                            -- ddaa




reply via email to

[Prev in Thread] Current Thread [Next in Thread]