Main action method — it looksup the command, and executes it, translating
 various exception conditions into meaningful error messages.
14962
def execute
      process_output(execute!)

    rescue ::OpenSSL::Cipher::CipherError => e
      { reason:    'Invalid key provided',
        exception: e }

    rescue Sym::Errors::Error => e
      { reason:    e.class.name.gsub(/.*::/, '').underscore.humanize.downcase,
        exception: e }

    rescue TypeError => e
      if e.message =~ /marshal/m
        { reason:    'Corrupt source data or invalid/corrupt key provided',
          exception: e }
      else
        { exception: e }
      end

    rescue StandardError => e
      { exception: e }
    end
86867
public static void main(String[] args)
	{
		CommandLineRemoteRunner runner = new CommandLineRemoteRunner();
		LoggingMonitor monitor = new LoggingMonitor(System.out, System.err);
		runner.setMonitor(monitor);

		try
		{
			runner.run(args);
		}
		catch (ParseException e)
		{
			System.err.println(e.getMessage());
			System.err.println("Try '--help' for more information.");

			if (e.getCause() != null)
			{
				System.err.println("Caused by:");
				e.getCause().printStackTrace(System.err);
			}

			System.exit(1);
		}
		catch (Throwable t)
		{
			monitor.exceptionOccured(t);
			System.exit(1);
		}
	}
1060440
def execute(self, *args, **kwargs):
        
        self.walk(*args, **kwargs)

        failed_steps = [step for step in self.steps if step.status == FAILED]
        if failed_steps:
            raise PlanFailed(failed_steps)
1063266
private void runImpl() throws IOException, SQLException, Throwable {
		if(args!=null && args.length>0) {
			handleCommandImpl(args);
		} else {
			// The arguments that have been read so far
			List<String> arguments=new ArrayList<>();

			// The argument that is being read.
			StringBuilder argument=new StringBuilder();
			boolean hasArgument=false;
			int quoteChar=-1;

			if(isInteractive) {
				out.print(getPrompt());
				out.flush();
			}
			// Read until end of file or exit command
			int ch;
			while((ch=in.read())!=-1) {
				// Skip windows '\r'
				if(ch!='\r') {
					if(ch=='\\') {
						// Process escapes
						ch=in.read();
						if(ch==-1) throw new EOFException("unexpected EOF processing escape: \\");
						if(ch=='\r') {
							// Skip windows '\r'
							ch=in.read();
							if(ch==-1) throw new EOFException("unexpected EOF processing escape: \\");
						}
						// Skip '\n' when it is escaped
						if(ch=='\n') {
							if(isInteractive) {
								out.print("\\> ");
								out.flush();
							}
						} else {
							// skip the escape only when followed by ' when using single quotes
							if(quoteChar=='\'' && ch!='\'') {
								argument.append('\\').append((char)ch);
								hasArgument=true;
							} else {
								// use the second character for anything left
								argument.append((char)ch);
								hasArgument=true;
							}
						}
					} else if(quoteChar=='\'') {
						// Handle reading single quote
						if(ch=='\'') quoteChar=-1;
						else {
							argument.append((char)ch);
							if(isInteractive && ch=='\n') {
								out.print("'> ");
								out.flush();
							}
						}
					} else if(quoteChar=='"') {
						// Handle reading double quote
						if(ch=='"') quoteChar=-1;
						else {
							argument.append((char)ch);
							if(isInteractive && ch=='\n') {
								out.print("\"> ");
								out.flush();
							}
						}
					} else {
						// Read as unquoted input
						if(ch=='\n') {
							// End of line means end of command if not in a quote mode
							if(hasArgument) {
								arguments.add(argument.toString());
								argument.setLength(0);
								hasArgument=false;
							}
							if(isInteractive) printFinishedJobs();
							if(arguments.size()>0) {
								boolean doMore=handleCommandImpl(arguments);
								arguments.clear();
								if(!doMore) break;
							}
							if(isInteractive) {
								out.print(getPrompt());
								out.flush();
							}
						} else if(ch<=' ') {
							// Whitespace separates commands or is skipped
							if(hasArgument) {
								arguments.add(argument.toString());
								argument.setLength(0);
								hasArgument=false;
							}
						} else if(ch=='\'' || ch=='"') {
							// Beginning quote
							quoteChar=ch;
							hasArgument=true;
						} else {
							// Everything else is part of the argument are begins the next argument
							argument.append((char)ch);
							hasArgument=true;
						}
					}
				}
			}
			// If currently parsing quote, throw error
			if(quoteChar!=-1) throw new EOFException("unexpected EOF when processing quote: "+quoteChar);

			// If commands have been parsed and not executed, run them now
			if(hasArgument) {
				arguments.add(argument.toString());
				argument.setLength(0);
			}
			if(arguments.size()>0) {
				handleCommandImpl(arguments);
				arguments.clear();
			}
			if(status==null || "Running".equals(status)) status="Done";
		}
		// Make the parent of all children the parent of this, and add children to the parents processes
		ShellInterpreter myparent=this.parent;
		synchronized(jobs) {
			for (ShellInterpreter shell : jobs) {
				shell.parent=myparent;
				if(myparent!=null) myparent.jobs.add(shell); // Should this synchronize myparent.jobs, too?
			}
			jobs.clear();
		}
	}
74538
function checkCommand (command, errorCallback) {
    var exec = command
    var args = this.argsExecutable
    var shell = false
    if (this.win) {
      // Arguments have to be manually quoted
      exec = `"${exec}"`
      args = args.map(a => `"${a}"`)
      shell = true
    }

    this.log.verbose(`- executing "${command}" to get executable path`)
    this.run(exec, args, shell, function (err, execPath) {
      // Possible outcomes:
      // - Error: not in PATH, not executable or execution fails
      // - Gibberish: the next command to check version will fail
      // - Absolute path to executable
      if (err) {
        this.addLog(`- "${command}" is not in PATH or produced an error`)
        return errorCallback(err)
      }
      this.addLog(`- executable path is "${execPath}"`)
      this.checkExecPath(execPath, errorCallback)
    }.bind(this))
  }
844314
@Override
  public void execute() {
    super.execute();
    if (output == null) {
      System.err.println(
          "Please add an <output> for the <" + getTaskName() + "> at " + this.getLocation());
      return;
    }

    // Gather output in a buffer rather than generating a bad file with a valid timestamp.
    StringBuilder sb = new StringBuilder();

    // Output the source files that use the helper functions first, so we get the appropriate file
    // overviews and copyright headers.
    for (FileRef input : inputs) {
      try {
        boolean inGeneratedCode = false;
        for (String line : Files.readLines(input.file, Charsets.UTF_8)) {
          // Skip code between generated code markers so that this transformation is idempotent.
          // We can run an old output through this class, and get the latest version out.
          if (inGeneratedCode) {
            if (GENERATED_CODE_END_MARKER.equals(line.trim())) {
              inGeneratedCode = false;
            }
          } else if (GENERATED_CODE_START_MARKER.equals(line.trim())) {
            inGeneratedCode = true;
          } else {
            sb.append(line).append('\n');
          }
        }
      } catch (IOException ex) {
        System.err.println("Failed to read " + input.file);
        ex.printStackTrace();
        return;
      }
    }

    // Generate helper functions for escape directives.
    generateCode(availableIdentifiers, sb);

    // Output a file now that we know generation hasn't failed.
    try {
      Files.asCharSink(output.file, Charsets.UTF_8).write(sb);
    } catch (IOException ex) {
      // Make sure an abortive write does not leave a file w
      output.file.delete();
    }
  }
522740
public void runLocalCommand(String command) throws Exception {

        String result = "";
        String line;
        Process p;
        try {
            p = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", command});
            p.waitFor();
        } catch (java.io.IOException e) {
            this.commandExitStatus = 1;
            this.commandResult = "Error";
            return;
        }

        BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
        while ((line = input.readLine()) != null) {
            result += line;
        }

        input.close();
        this.commandResult = result;
        this.commandExitStatus = p.exitValue();

        p.destroy();

        if (p.isAlive()) {
            p.destroyForcibly();
        }

    }
375809
def process_action(*args)
      super
    rescue Exception => exception
      raise if RocketPants.pass_through_errors?
      # Otherwise, use the default built in handler.
      logger.error "Exception occured: #{exception.class.name} - #{exception.message}"
      logger.error "Exception backtrace:"
      exception.backtrace[0, 10].each do |backtrace_line|
        logger.error "=> #{backtrace_line}"
      end
      exception_notifier_callback.call(self, exception, request)
      render_error exception
    end
1349850
public function main() {
        $this->stdout->styles('success', array('text' => 'green'));

        $this->hr(1);
        $this->out(sprintf('%s Steps:', $this->name));

        $counter = 1;

        foreach ($this->steps as $method) {
            $this->steps($counter);

            try {
                if (!call_user_func(array($this, $method))) {
                    $this->err('<error>Process aborted!</error>');
                    break;
                }
            } catch (Exception $e) {
                $this->err(sprintf('<error>Unexpected error has occurred; %s</error>', $e->getMessage()));
                break;
            }

            $counter++;
        }
    }
416366
private Object execute(Object o, Method m, Object... args) throws CommandActionExecutionException {
        Object result = null;
        try {
            m.setAccessible(true); // suppress Java language access
            if (isCompileWeaving() && metaHolder.getAjcMethod() != null) {
                result = invokeAjcMethod(metaHolder.getAjcMethod(), o, metaHolder, args);
            } else {
                result = m.invoke(o, args);
            }
        } catch (IllegalAccessException e) {
            propagateCause(e);
        } catch (InvocationTargetException e) {
            propagateCause(e);
        }
        return result;
    }
265528
public static void main(String[] args) {
        for (Version v: identify().values()) {
            System.err.println(v);
        }
    }
721132
def execute(self, commands):
        
        try:
            commands = [i.strip() for i in commands.split(' ; ')]
        except (TypeError, AttributeError):
            pass # assume an iterable

        for command in commands:
            try:
                method, args = command.split('=', 1)
                args = tuple(CommaLexer(args))
            except (ValueError, TypeError) as exc:
                raise error.UserError("Bad command %r, probably missing a '=' (%s)" % (command, exc))

            def print_result(data):
                "Helper to print XMLRPC call results"
                args_list = ''
                if args:
                    args_list = '"' + '","'.join(args) + '"'
                print('%s\t%s\t%s=%s' % (self._fields["hash"], data, method.lstrip(':'), args_list))

            observer = print_result if method.startswith('>') else None
            method = method.lstrip('>')
            if not (method.startswith(':') or method[:2].endswith('.')):
                method = 'd.' + method
            self._make_it_so("executing command on", [method], *args, observer=observer)
1244932
@Override
    protected void doExecute() throws Exception {
        final CommandHandler commandHandler = new CommandHandlerImpl(this.getLog());

        checkStageDirectoryExistence();

        checkRuntimeExistence(commandHandler);

        runFunctions(commandHandler);
    }
1087774
private void execute() throws Exception {
		if (result == null) {
			env.execute(executionName);
		} else {
			output.write(executionName.toString(), System.out, result);
		}

		System.out.println();
		algorithm.printAnalytics(System.out);

		if (jobDetailsPath.getValue() != null) {
			writeJobDetails(env, jobDetailsPath.getValue());
		}
	}
298394
def dispatch(self, command):
        
        log.info("Dispatch on %s", command)
        if not command:
            return "OK"
        
        action, params = self.parse_command(command)
        log.debug("Action = %s, Params = %s", action, params)
        try:
            function = getattr(self, "do_" + action, None)
            if function:
                function(*params)
            return "OK"
        except KeyboardInterrupt:
            raise
        except Exception as exc:
            log.exception("Problem executing action %s", action)
            return "ERROR: %s" % exc
283879
public void execute() throws BuildException {
        if (getHost() == null) {
            throw new BuildException("Host is required.");
        }
        if (getUserInfo().getName() == null) {
            throw new BuildException("Username is required.");
        }
        if (getUserInfo().getKeyfile() == null
            && getUserInfo().getPassword() == null
            && getSshKeyData() == null) {
            throw new BuildException("Password or Keyfile is required.");
        }
        if (command == null && commandResource == null) {
            throw new BuildException("Command or commandResource is required.");
        }

        if (inputFile != null && inputProperty != null) {
            throw new BuildException("You can't specify both inputFile and"
                                     + " inputProperty.");
        }
        if (inputFile != null && !inputFile.exists()) {
            throw new BuildException("The input file "
                                     + inputFile.getAbsolutePath()
                                     + " does not exist.");
        }

        Session session = null;
        StringBuffer output = new StringBuffer();
        try {
            session = openSession();

            if(null!=getDisconnectHolder()){
                final Session sub=session;
                getDisconnectHolder().setDisconnectable(new Disconnectable() {
                    public void disconnect() {
                        sub.disconnect();
                    }
                });
            }

            /* called once */
            if (command != null) {
                executeCommand(session, command, output);
            } else { // read command resource and execute for each command
                try {
                    BufferedReader br = new BufferedReader(
                            new InputStreamReader(commandResource.getInputStream()));
                    String cmd;
                    while ((cmd = br.readLine()) != null) {
                        executeCommand(session, cmd, output);
                        output.append("\n");
                    }
                    FileUtils.close(br);
                } catch (IOException e) {
                    if (getFailonerror()) {
                        throw new BuildException(e);
                    } else {
                        log("Caught exception: " + e.getMessage(),
                            Project.MSG_ERR);
                    }
                }
            }
        } catch (JSchException e) {
            if (getFailonerror()) {
                throw new BuildException(e);
            } else {
                log("Caught exception: " + e.getMessage(), Project.MSG_ERR);
            }
        } finally {
            try {
                if (null != this.sshAgentProcess) {
                    this.sshAgentProcess.stopAgent();
                }
            } catch (IOException e) {
                log( "Caught exception: " + e.getMessage(), Project.MSG_ERR);
            }
            if (outputProperty != null) {
                getProject().setNewProperty(outputProperty, output.toString());
            }
            if (session != null && session.isConnected()) {
                session.disconnect();
            }
        }
    }
275
public static void main(String[] args) {
    System.err.println(toString(new int[] { Integer.parseInt(args[0]) }));
  }