in reply to How to open a pipe from CMD if CMD has quotes?

I'm not getting any errors just using the snippets you posted above. Can you give us the exact message it gives you when you fail? And, maybe post the second version of $cmd in context showing us how it's used? Specifically, I don't have nmake, so I wrote a little program to show the arguments it receives instead. I get this output using your snippet above:
use strict; use warnings; my $cmd=qq|showargs NODEBUG=1 "ADDED_CFLAGS=/DCOST_EN_US /DPAYMENT_CRE +DIT_CARD"|; print "$cmd\n"; open(RS,"$cmd 2>&1 |") or die "Can't open pipe: $!\n"; while (<RS>) { print; } close(RS);
Here's the output, showing the complete quoted second argument you had:
showargs NODEBUG=1 "ADDED_CFLAGS=/DCOST_EN_US /DPAYMENT_CREDIT_CARD" Arguments were: 0: NODEBUG=1 1: ADDED_CFLAGS=/DCOST_EN_US /DPAYMENT_CREDIT_CARD

---
s;;:<).>|\;\;_>?\\^0<|=!]=,|{\$/.'>|<?.|/"&?=#!>%\$|#/\$%{};;y;,'} -/:-@[-`{-};,'}`-{/" -;;s;;$_;see;
Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.

Replies are listed 'Best First'.
Re^2: How to open a pipe from CMD if CMD has quotes?
by slloyd (Hermit) on Dec 05, 2007 at 01:07 UTC
    I wonder if this behavior is specific to nmake? I will do some more debugging on this tonight and post what I find. Steve

    -------------------------------
    Need a good Perl friendly Host Provider?
    http://www.dreamhost.com

      Without knowing what your error was in it's specific context, I can't really point you anywhere. However, passing of command line arguments is handled by the shell (except in DOS, where I think you have to parse them out yourself), so if you are using a unix shell, your quoting of the command line is correct if you indeed intended 2 arguments. Let us know what you find with further testing.

      ---
      s;;:<).>|\;\;_>?\\^0<|=!]=,|{\$/.'>|<?.|/"&?=#!>%\$|#/\$%{};;y;,'} -/:-@[-`{-};,'}`-{/" -;;s;;$_;see;
      Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.

        The problem ended up being on my end. Someone had installed cygwin and placed it in the path. It was trying to call /usr/bin/rmdir instead of the windows rmdir so the builds were not getting cleaned... Sorry for the bother :)

        -------------------------------
        Need a good Perl friendly Host Provider?
        http://www.dreamhost.com