Clear POSIXLY_CORRECT when using optparse
In case a user (perhaps inadvertently, or for particular reasons) has POSIXLY_CORRECT set in their environment, make sure to clear it before calling optparse.optparse!() since we don't really want POSIXLY_CORRECT argument parsing.
This commit is contained in:
parent
e697f2f9a5
commit
583fb3c787
|
@ -43,6 +43,9 @@ module Vagrant
|
||||||
# If this method returns `nil`, then you should assume that help
|
# If this method returns `nil`, then you should assume that help
|
||||||
# was printed and parsing failed.
|
# was printed and parsing failed.
|
||||||
def parse_options(opts=nil)
|
def parse_options(opts=nil)
|
||||||
|
# make sure optparse doesn't use POSIXLY_CORRECT parsing
|
||||||
|
ENV["POSIXLY_CORRECT"] = nil
|
||||||
|
|
||||||
# Creating a shallow copy of the arguments so the OptionParser
|
# Creating a shallow copy of the arguments so the OptionParser
|
||||||
# doesn't destroy the originals.
|
# doesn't destroy the originals.
|
||||||
argv = @argv.dup
|
argv = @argv.dup
|
||||||
|
|
Loading…
Reference in New Issue