[Israel.pm] Problem timing-out a system command when script runs in the background

Yuval Yaari yuval at windax.com
Sun Aug 29 01:31:52 PDT 2004


Sorry if the subject isn't descriptive enough.
I wrote a script that extracts archives (zip, tar, gz, bz2, etc) recursivly.
I had a problem with zip files that have a password, so I just used the
famous alarm trick (read: hack) to time it out.

The code is something like:
eval {
  system('unzip', 'flags', $file);
  # Also check for return code, etc
if ($@) {
  # Move the file away

The problem is, that it won't work when I run the script in the background
(using nohup or just adding an & in the end of the command line).

I'm not sure why it might happen, but your ideas are more than welcome :)

Also, if anyone has a solution for checking if a zip file is password
protected, and/or timing it out better - let me know.


More information about the Perl mailing list