kernel/common/process_mirror.rb
# Converts the various supported command argument variations into a
# standard argv suitable for use with exec. This includes detecting commands
# to be run through the shell.
#
# The args array may follow any of these variations:
#
# 'true'                     => ['true', ['true']]
# 'echo', 'hello', 'world'   => ['echo', ['echo', 'hello', 'world']]
# 'echo *'                   => ['/bin/sh', ['sh', '-c', 'echo *']]
# ['echo', 'fuuu'], 'hello'  => ['echo', ['fuuu', 'hello']]
Converts the various supported command argument variations into a
standard argv suitable for use with exec. This includes detecting commands
to be run through the shell.

The args array may follow any of these variations.


Converts the various supported command argument variations into a standard argv suitable for use with exec . This includes detecting commands to be run through the shell . The args array may follow any of these variations .
def process_command
          if @arguments.empty? and
              cmd = Rubinius::Type.try_convert(@command, ::String, :to_str)
            if cmd.empty?
              raise Errno::ENOENT
            else
              @command = cmd
              @argv = []
              return
            end
          elsif cmd = Rubinius::Type.try_convert(@command, ::Array, :to_ary)
            raise ArgumentError, "wrong first argument" unless cmd.size == 2
            command = StringValue(cmd[0])
            name = StringValue(cmd[1])
          else
            name = command = StringValue(@command)
          end
          argv = [name]
          @arguments.each do |arg|
            argv << StringValue(arg)
          end
          @command = command
          @argv = argv
        end
def process_command if @arguments . empty? and cmd = Rubinius :: Type . try_convert ( @command , :: String , :to_str ) if cmd . empty? raise Errno :: ENOENT else @command = cmd @argv = [ ] return end elsif cmd = Rubinius :: Type . try_convert ( @command , :: Array , :to_ary ) raise ArgumentError , "wrong first argument" unless cmd . size == 2 command = StringValue ( cmd [ 0 ] ) name = StringValue ( cmd [ 1 ] ) else name = command = StringValue ( @command ) end argv = [ name ] @arguments . each do | arg | argv << StringValue ( arg ) end @command = command @argv = argv end
Converts the various supported command argument variations into a
standard argv suitable for use with exec.
Converts the various supported command argument variations into a standard argv suitable for use with exec .