|P is for Practical|
Calling Windows Batch from Perl, double-quote appearing out of nowhereby rovf (Priest)
|on Nov 09, 2012 at 13:50 UTC||Need Help??|
rovf has asked for the
wisdom of the Perl Monks concerning the following question:
(I tested this with ActiveState Perl 5.8.8 and 5.12 on Windows 7 (64 bit))
I have the following batch file testing.bat:
Note that this batch file ignores its first parameter and just uses its second. It seems to be important to demonstrate this bug to have a batch file which will be called with 2 parameters. Further, I have the following Perl program testing.pl:
This just calls testing.bat with in background, and terminates when the child also terminated. Running the batch file in background seems to be crucial for this bug (?) to occur. BTW, the sleep in the batch file is not essential to demonstrate the problem, but it shows that the wait indeed waits until the child terminates.
When I run perl testing.pl, I get the following output:
We see that there occurs suddenly a double quote inside the redirection, which in turn causes the error message. Any idea where this spurious double-quote comes from? Also, could someone try to reproduce this behaviour, either with the same Perl version, or with a newer one, an let me know the outcome?
Also interesting: From my experiments with this problem, the program posted here seems to be the minimal one. Whenever I tried to simplify it further (reducing the number of parameters in the batchfile, for instance), the problem did not show up.
Ronald Fischer <email@example.com>