Just now I needed to run a Ruby executable that was located in a world-writable directory.
Normally this is something that you never want to do - anyone could put an executable into your directory and/or replace your script with their own. BUT sometimes you just need to do this - in my case I am in a secure environment, working with collaborators but we have not been able to get IT to set us up as a 'group' as yet.
The problem is that Ruby will issue a warning about "Insecure world writable directory" every time you run your script.
The real solution is to get past the need for those permissions. But in the short term I just want to get rid of the warnings.
There are two options:
You can pass the -W0 (that's a zero) flag to ruby
$ ruby -W0
But I use this 'hash bang' line at the start of all my scripts:
and I can't figure out how to pass the flag correctly in this case
The alternative is to add this line right after the hash bang line
$VERBOSE = nil
That does work. It clearly silences any other warnings that I might want to see but at least it gets me past my current issue.
Archive of Tips
- ▼ February (2)
- ► 2011 (44)
- ► 2010 (40)
- ► 2009 (53)
- ► 2008 (21)