Hello, I've been working on a Perl test suite for darcs, with notable recent help from Schwern.
We used to have tests that looked like this: like(`echo y | darcs command`,qr/$re/); That would run the command and answer "y" to the first and only question it asked. It worked well enough, but I looked for for a pure Perl solution in the spirit of "being more portable". I came up with this: { open2(*READ, *WRITE, "$DARCS unpull -p add"); print WRITE "a\n"; like( (<READ>)[4], qr/really unpull/i, "additional confirmation is given when 'all' option is selected"); close(WRITE); close(READ); # (We never confirmed, so those patches are still there ) } This is more time consuming to write, because not only is more verbose, but I know exactly how many lines to read on STDERR. Already for two people something got slightly off, causing the test to hang indefinitely. Windows users weren't having problems with the first method, so maybe I should just go back to that. I'm I missing an easier and less fragile way to test interactive commands with Perl? Thanks! Mark -- -- . . . . . . . . . . . . . . . . . . . . . . . . . . . Mark Stosberg Principal Developer [EMAIL PROTECTED] Summersault, LLC 765-939-9301 ext 202 database driven websites . . . . . http://www.summersault.com/ . . . . . . . .