fix error where commands was nil

git-svn-id: file:///home/svn/framework3/trunk@11335 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-12-14 19:28:44 +00:00
parent 1c2c3ed1f6
commit de69a2b9bf
1 changed files with 19 additions and 18 deletions

View File

@ -63,27 +63,28 @@ def usage
raise Rex::Script::Completed raise Rex::Script::Completed
end end
################## Main ################## ################## Main ##################
@@exec_opts.parse(args) { |opt, idx, val| @@exec_opts.parse(args) { |opt, idx, val|
case opt case opt
when "-cl"
commands = val.split(",")
when "-rc"
script = val
if not ::File.exists?(script)
raise "Command List File does not exists!"
else
::File.open(script, "r").each_line do |line|
commands << line.chomp
end
end
when "-f"
outfile = val
when "-h"
help = 1
end
when "-cl"
commands = val.split(",")
when "-rc"
script = val
if not ::File.exists?(script)
raise "Command List File does not exists!"
else
commands ||= ''
::File.open(script, "r").each_line do |line|
commands << line.chomp
end
end
when "-f"
outfile = val
when "-h"
help = 1
end
} }
if args.length == 0 or help == 1 if args.length == 0 or help == 1