[darcs-users] redirection, terminal detection and apply -i

Eric Kow kowey at darcs.net
Tue Mar 23 10:13:10 UTC 2010


Hi everyone,

I asked Judah what the story on portable terminal detection was, and
here is his reply.

So there are two open issues:

  - issue1648 : how should darcs apply -i behave?
  - issue1633 : should apply -i be the default? [idem, changes -i]

It looks like with a new version of Haskeline, we should definitely fix
issue1648 by making it do terminal detection and falling back to stdin.

It also seems like we can now re-open the discussion on making apply -i
the default.  Does what Judah proposes cover enough uses cases that it's
safe to flip the default?

Thanks!

Eric

On Tue, Mar 23, 2010 at 07:14:55 +0000, Judah Jacobson wrote:
> > Our conclusion was that before we need to research the problem more, and
> > determine if there was a portable way to reliably detect if we were on a
> > terminal or not.  Windows may be an issue here.

> Sure.  There's a Windows equivalent to /dev/tty ("CONIN$" and
> "CONOUT$"); Haskeline already uses the latter but not yet the former.
> I did some tests, and trying to open CONIN looks like a reliable way
> to check whether we're in a console session.*
> 
> So I believe there's no technical barriers to a robust
> terminal-checking in the backend of Haskeline.  The best approach
> seems to me to add a function to Haskeline's API.  For example:
> 
> runInputTInTerm :: Settings m -> InputT m a -> m (Maybe a)
> 
> which tries to run the given action(s) using the terminal, even if
> it's not stdin; and returns Nothing if it couldn't connect to
> [/dev/tty,CONIN$].  This should give Darcs some flexibility in
> deciding the exact semantics of apply -i.
> 
> 
> *The one caveat: in a Cygwin X shell, we can't connect to CONIN.  But
> Haskeline doesn't provide any interactive editing in that setting
> anyway, so this seems OK to me.  (There's little I can do about that
> unless GHC improves its Cygwin support.)

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100323/adc23cd4/attachment.pgp>


More information about the darcs-users mailing list