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: Aaron Bentley
Subject: Re: [Gnu-arch-users] tla & user interactivity
Date: Wed, 24 Mar 2004 09:37:31 -0500
User-agent: Mozilla Thunderbird 0.5 (X11/20040309)

David Allouche wrote:

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.

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.

Hoo boy.  That's pretty pathological.  My ssh keys are in ssh-agent, and
I don't sign my archive, but...

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.

So far, it hasn't been a problem, but I can see it could be.  But
everyone filters stdout this way.

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).

OOH, how 'bout a hackerlab colorizer handler?  Then chatter_fd could be
different from stdout (or /dev/null).

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).

I guess another option would be a colorizing wrapper that handled stderr
and stdout as separate file descriptors.

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

I am in Worse is Better mode.  Current versions of aba support an
abafilter (should probably be uppercase) variable.  If present, the
specified command is used as a pipe for non-interactive commands.

But I won't disregard your message, because it's important to know how
it would be done The Right Way.  Thanks for the insight.

Aaron

--
Aaron Bentley
Director of Technology
Panometrics, Inc.





reply via email to

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