Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: df sometimes hangs in Win32 OS

by Dandello (Scribe)
on Sep 22, 2012 at 21:42 UTC ( #995138=note: print w/ replies, xml ) Need Help??


in reply to Re: df sometimes hangs in Win32 OS
in thread df sometimes hangs in Win32 OS

So, what I think is being said is that the script this is in needs an OS checker so it can load a Win32 specific utility to do the job?

The script needs to be cross-platform. 95%+ of the installations are on *nix. Maybe 5% of the Win installs come up with this problem. So it's a pretty rare issue.


Comment on Re^2: df sometimes hangs in Win32 OS
Re^3: df sometimes hangs in Win32 OS
by BrowserUk (Pope) on Sep 22, 2012 at 22:21 UTC
    So, what I think is being said is that the script this is in needs an OS checker so it can load a Win32 specific utility to do the job?

    I have a df utility on my windows system -- part of the UnxUtils package though it segfaults on my 64-bit OS -- but generally most windows systems will not have it, and expecting users to find and install one is naive.

    Far simpler I think to use something like:

    sub freespace { if( $^O eq 'MSWin32' ) { `fsutil volume diskfree .` =~ m[avail free bytes : (\d+)]; return ( $1 // die $! ) / 1024; } elsif( $^O eq ... ) { ... } else { `df -k .` =~ m[...]; return $1 // die $! } } ... my $free = freespace();

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

    div class=

      Thank you - this is exactly what I need.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995138]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-12-21 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (108 votes), past polls