bug-autoconf
[Top][All Lists]
Advanced

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

Re: AT_CHECK_INTERACTIVE


From: Paul Eggert
Subject: Re: AT_CHECK_INTERACTIVE
Date: Sat, 16 Dec 2006 22:27:35 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> I'm thinking of something along these lines:
>
>   mkfifo at-fifo-err
>   mkfifo at-fifo-out
>   command='{ sleep 2; echo out ; echo err >&2; sleep 2; exit 42; }'
>   ( exec >at-fifo-out 2>at-fifo-err ; eval "$command" ) & at_cmd1=$!
>   tee < at-fifo-out stdout & at_cmd2=$!
>   tee < at-fifo-err stderr & at_cmd3=$!
>   wait $at_cmd2 $at_cmd3 $at_cmd1
>
> for an AT_CHECK_INTERACTIVE.  How portable is this?  It could degenerate
> to current AT_CHECK on systems without mkfifo.  Are there any such
> except DJGPP, MSDOS, MSYS?  Does Cygwin now have a working mkfifo?  Does
> anyone know of a solution without fifos?

Sure, just use pipes.  You shouldn't need any of the stuff with fifos
and sleeps and wait.  It will be a bit of a pain to save $command's
exit status, given that $command's output will be piped, but you can
use something like the following trick (taken from zgrep):

      # Fail if either grep or sed fails.
      exec 3>&1
      r=`
        exec 4>&1
        (grep "$pattern" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&-
      ` &&
      exit $r

By the way, the name AT_CHECK_INTERACTIVE confused me, since I assumed
it was testing an interactive program, or was a test you could run
interactively.  Perhaps a better name would be AT_CHECK_MONITOR (or
AT_CHECK_IMPATIENTLY :-)?




reply via email to

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