Permalink
Browse files

Be consistent about splatting and flattening of arrays

  • Loading branch information...
1 parent e1dc9d5 commit 250f7a40df572e4abe28c6f54f4a6614242d42f2 @copiousfreetime committed Jul 17, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/launchy/detect/runner.rb
@@ -38,7 +38,7 @@ def self.detect
#
def shell_commands( cmd, args )
cmdline = [ cmd.shellsplit ]
- cmdline << args.collect{ |a| a.to_s.shellescape }
+ cmdline << args.flatten.collect{ |a| a.to_s.shellescape }
return commandline_normalize( cmdline )
end
@@ -76,9 +76,9 @@ def dry_run( cmd, *args )
all_args( cmd, *args ).join(" ")
end
- def shell_commands( cmd, args )
+ def shell_commands( cmd, *args )
cmdline = [ cmd ]
- cmdline << args.collect { |a| a.to_s.gsub("&", "^&") }
+ cmdline << args.flatten.collect { |a| a.to_s.gsub("&", "^&") }
return commandline_normalize( cmdline )
end
@@ -89,14 +89,14 @@ def wet_run( cmd, *args )
class Jruby < Runner
def wet_run( cmd, *args )
- Spoon.spawnp( *shell_commands( cmd, args ) )
+ Spoon.spawnp( *shell_commands( cmd, *args ) )
end
end
class Forkable < Runner
def wet_run( cmd, *args )
child_pid = fork do
- exec( *shell_commands( cmd, args ))
+ exec( *shell_commands( cmd, *args ))
exit!
end
Process.detach( child_pid )

0 comments on commit 250f7a4

Please sign in to comment.