Fork/exec the given command, returns immediately
   +command+ is the String containing the shell command

 Returns nothing
519929
def spawn(command)
      fork do
        File.umask self.umask if self.umask
        uid_num = Etc.getpwnam(self.uid).uid if self.uid
        gid_num = Etc.getgrnam(self.gid).gid if self.gid
        gid_num = Etc.getpwnam(self.uid).gid if self.gid.nil? && self.uid

        ::Dir.chroot(self.chroot) if self.chroot
        ::Process.setsid
        ::Process.groups = [gid_num] if gid_num
        ::Process.initgroups(self.uid, gid_num) if self.uid && gid_num
        ::Process::Sys.setgid(gid_num) if gid_num
        ::Process::Sys.setuid(uid_num) if self.uid
        self.dir ||= '/'
        Dir.chdir self.dir
        $0 = command
        STDIN.reopen "/dev/null"
        if self.log_cmd
          STDOUT.reopen IO.popen(self.log_cmd, "a")
        else
          STDOUT.reopen file_in_chroot(self.log), "a"
        end
        if err_log_cmd
          STDERR.reopen IO.popen(err_log_cmd, "a")
        elsif err_log && (log_cmd || err_log != log)
          STDERR.reopen file_in_chroot(err_log), "a"
        else
          STDERR.reopen STDOUT
        end

        # close any other file descriptors
        3.upto(256){|fd| IO::new(fd).close rescue nil}

        if self.env && self.env.is_a?(Hash)
          self.env.each do |(key, value)|
            ENV[key] = value.to_s
          end
        end

        exec command unless command.empty?
      end
    end
577491
def do_shell(self, args: argparse.Namespace) -> None:
        """"""
        import subprocess

        # Create a list of arguments to shell
        tokens = [args.command] + args.command_args

        # Support expanding ~ in quoted paths
        for index, _ in enumerate(tokens):
            if tokens[index]:
                # Check if the token is quoted. Since parsing already passed, there isn't
                # an unclosed quote. So we only need to check the first character.
                first_char = tokens[index][0]
                if first_char in constants.QUOTES:
                    tokens[index] = utils.strip_quotes(tokens[index])

                tokens[index] = os.path.expanduser(tokens[index])

                # Restore the quotes
                if first_char in constants.QUOTES:
                    tokens[index] = first_char + tokens[index] + first_char

        expanded_command = ' '.join(tokens)

        # Prevent KeyboardInterrupts while in the shell process. The shell process will
        # still receive the SIGINT since it is in the same process group as us.
        with self.sigint_protection:
            # For any stream that is a StdSim, we will use a pipe so we can capture its output
            proc = subprocess.Popen(expanded_command,
                                    stdout=subprocess.PIPE if isinstance(self.stdout, utils.StdSim) else self.stdout,
                                    stderr=subprocess.PIPE if isinstance(sys.stderr, utils.StdSim) else sys.stderr,
                                    shell=True)

            proc_reader = utils.ProcReader(proc, self.stdout, sys.stderr)
            proc_reader.wait()
112620
def execute_command(self, command):
        

        self.runner.info_log("Executing command: %s" % command)

        process = Popen(
                command,
                stdout=open(os.devnull, 'w'),
                stderr=open('runner.log', 'a'),
        )

        return process
650753
private String executeCommand() throws IOException, InterruptedException {
        ProcessBuilder processBuilder = new ProcessBuilder(command);

        ByteArrayOutputStream commandOutput = new ByteArrayOutputStream();

        Process process = processBuilder.start();
        try {
            IOUtils.copy(process.getInputStream(), commandOutput, processOutputLimit);

            process.waitFor();

            if (process.exitValue() != 0) {
                throw new IllegalStateException("Command returned non-zero exit value: " + process.exitValue());
            }

            return new String(commandOutput.toByteArray(), StringUtils.UTF8);
        } finally {
            process.destroy();
        }
    }
1329598
def shell(command, *args):
	''''''
	if args:
		command = command.format(*args)

	print LOCALE['shell'].format(command)

	try:
		return subprocess.check_output(command, shell=True)
	except subprocess.CalledProcessError, ex:
		return ex
835227
def exec_cmd(self, cmd):
        '''
        
        '''
        cmd = self._cmd_str(cmd)

        logmsg = 'Executing command: {0}'.format(cmd)
        if self.passwd:
            logmsg = logmsg.replace(self.passwd, ('*' * 6))
        if 'decode("base64")' in logmsg or 'base64.b64decode(' in logmsg:
            log.debug('Executed SHIM command. Command logged to TRACE')
            log.trace(logmsg)
        else:
            log.debug(logmsg)

        ret = self._run_cmd(cmd)
        return ret
5660
function execSpawn(command, args, resultMsg, errorMsg) {
    return superspawn.spawn(command, args).then(function(result) {
        return resultMsg + result;
    }, function(error) {
        return errorMsg + error;
    });
}
1199974
def execute_action_command(command: nil)
      command_return = @command_executor.execute(command: command, target_object: nil)
      ## probably need to just return Strings, or ready_for_next with object isn't String
      return_object = command_return.return_value
      return_value_type = command_return.return_value_type
      closure_arg = command_return.closure_argument_value

      return_object = return_value_processor.prepare_object(
        return_value: return_object,
        return_value_type: return_value_type
      )

      if closure_arg.nil?
        closure_arg = closure_arg.to_s
      else
        closure_arg = return_value_processor.prepare_object(
          return_value: closure_arg,
          return_value_type: :string # always assume string for closure error_callback
        )
      end

      Thread.current[:exception] = nil

      payload = {
        payload: {
          status: "ready_for_next",
          return_object: return_object,
          closure_argument_value: closure_arg
        }
      }
      return JSON.generate(payload)
    rescue StandardError => e
      Thread.current[:exception] = e

      exception_array = []
      exception_array << "#{e.class}:"
      exception_array << e.backtrace

      while e.respond_to?("cause") && (e = e.cause)
        exception_array << "cause: #{e.class}"
        exception_array << e.backtrace
      end

      payload = {
        payload: {
          status: "failure",
          failure_information: exception_array.flatten
        }
      }
      return JSON.generate(payload)
    end
1248909
def shell(cmd, **kwargs):
    """"""
    logger.debug("$ %s", cmd)
    return subprocess.check_output(cmd, shell=True, **kwargs)
157312
function(command) {
      var t = this;
      t.shellCmd = ChildProcess.exec(command, function(err, stdout, stderr) {
        if (err) {
          var outstr = 'exit';
          if (err.code) {
            outstr += ' (' + err.code + ')';
          }
          if (err.signal) {
            outstr += ' ' + err.signal;
          }
          t._output(outstr);
          return null;
        }
        if (stdout.length) {
          t._output(stdout);
        }
        if (stderr.length) {
          t._output(stderr);
        }
        t.shellCmd = null;
        t._output(CONSOLE_PROMPT);
      });
      return null;
    }
1239176
def exec!(command, opts = {}, &block)
      $stdout.puts(command.to_s.blue) if verbose
      @ssh.exec! command, &block
    end
730873
def _execute(self, command, stdin=None, stdout=subprocess.PIPE):
        
        process = subprocess.Popen(command, shell=True, cwd=self.root_path, stdin=stdin, stdout=stdout)
        return (process.wait(), None if stdout is not subprocess.PIPE else process.communicate()[0].decode('utf-8'))
265790
def run_command(self, command, message):
        
        proc = subprocess.Popen([
            'echo \'%s\' | %s' % (fedmsg.encoding.dumps(message), command)
        ], shell=True, executable='/bin/bash')
        return proc.wait()
584670
def process_shell_command
      command_line.set_prompt ':!'
      cmd = command_line.get_command(prompt: ':!')[1..-1]
      execute_external_command pause: true do
        system cmd
      end
    rescue Interrupt
    ensure
      command_line.clear
      command_line.noutrefresh
    end
858163
def _exec_cmd(command):
    """"""
    proc = sp.Popen(command,
                    stdout=sp.PIPE,
                    shell=True)
    if six.PY2:
        res = proc.communicate()[0]
    else:
        res = proc.communicate(timeout=5)[0]
    return res, proc.returncode
739818
function exec(command, options) {
    var d = Promise.defer();

    var child = childProcess.exec(command, options, function(err, stdout, stderr) {
        if (!err) {
            return d.resolve();
        }

        err.message = stdout.toString('utf8') + stderr.toString('utf8');
        d.reject(err);
    });

    child.stdout.on('data', function (data) {
        d.notify(data);
    });

    child.stderr.on('data', function (data) {
        d.notify(data);
    });

    return d.promise;
}
887076
def execute(scope, command):
    
    process = Popen(command[0],
                    shell=True,
                    stdin=PIPE,
                    stdout=PIPE,
                    stderr=STDOUT,
                    close_fds=True)
    scope.define(__response__=process.stdout.read())
    return True