Problems? Is your data what you think it is? | |
PerlMonks |
opening '-|' on Windowsby Tanktalus (Canon) |
on Apr 16, 2005 at 00:12 UTC ( [id://448381]=perlquestion: print w/replies, xml ) | Need Help?? |
Tanktalus has asked for the wisdom of the Perl Monks concerning the following question: In Automated module install, I started to look at creating a simple script to untar some tarballs, and automatically install them. I have something that, at least before I started mangling it, was working on Linux. So I tried on Windows. Didn't get too far, I might mention. Perhaps someone here with a bit more Windows experience than I could shed some light. Environment: ActiveState 5.8.0, WindowsXP, and lots of Cygwin tools. (I'm hoping we get this upgraded to 5.8.6 soon - so if that's the solution, I'll just apply that pressure.) The command works fine if I run it at the command prompt, so it's not a lack of the proper tooling (gunzip and tar are both present). The problem seems to be where I try to run the open. fork works fine that I can test, but this seems to go all wonky on me. The error message is: Yet, as I said, if I run the given command at the command prompt manually, it works fine. I just installed ActiveState 5.8.6 ... different uninitialized value error message, but same "not recognized" message. As I'm writing this, I'm starting to wonder if opening '-|' is even going to work on Windows, or am I going to have to resort to some more trickery to get what I want? Namely, a way to get the directory that the untar command is doing. (I wish Archive::Tar and Compress::Zlib were part of the standard perl distribution!) Update: After reading tye's recommendation, I noticed IPC::Open3 has documented that this is a problem, so I'm going to have to replace the open call with something else. Thanks! Update: As a confirmation, the new do_pipe_command is: It works perfectly. No need to launch cmd.exe (which may be because my @cmd is always a single string anyway, at least when I'm chaining subprocesses together in their own pipe). I do realise that this will leave a zombie process behind (at least on unix), but that should be automatically cleaned up when we exit, and this is a very short-lived process anyway. It runs on Linux in under 5 seconds currently, so a few zombies is pretty minor.
Back to
Seekers of Perl Wisdom
|
|