Examples of CommandOutput


Examples of com.lambdaworks.redis.protocol.CommandOutput

      CommandArgs<byte[], byte[]> cmdArg = new CommandArgs<byte[], byte[]>(CODEC);
      if (!ObjectUtils.isEmpty(args)) {
        cmdArg.addKeys(args);
      }

      CommandOutput expectedOutput = commandOutputTypeHint != null ? commandOutputTypeHint : typeHints.getTypeHint(cmd);
      if (isPipelined()) {

        pipeline(new LettuceResult(getAsyncConnection().dispatch(cmd, expectedOutput, cmdArg)));
        return null;
      } else if (isQueueing()) {
View Full Code Here

Examples of com.tupilabs.pbs.util.CommandOutput

    }
  }

  // adapted from https://github.com/jenkinsci/call-remote-job-plugin/blob/master/src/main/java/org/ukiuni/callOtherJenkins/CallOtherJenkins/JenkinsRemoteIF.java
  private boolean seekEnd(String jobId, int numberOfDays, long span) {
    CommandOutput cmd = PBS.traceJob(jobId, numberOfDays);
   
    String out = cmd.getOutput();
    String err = cmd.getError();
   
    if (StringUtils.isBlank(out)) {
      listener.getLogger().println("Could not find job " + jobId + " in PBS logs...Marking build as UNSTABLE");
      listener.getLogger().println(err);
      return false;
View Full Code Here

Examples of com.tupilabs.pbs.util.CommandOutput

    return this.loopSeek(jobId);
  }
 
  private boolean loopSeek(String jobId) {
    while (true) {
      CommandOutput cmd = PBS.traceJob(jobId, numberOfDays);
     
      String out = cmd.getOutput();
      //String err = cmd.getError();
     
//      listener.getLogger().println(out);
//      listener.getLogger().println("----");
      Matcher matcher = JOB_STATUS_REGEX.matcher(out.toString());
View Full Code Here

Examples of com.tupilabs.pbs.util.CommandOutput

  public int getNumberOfDays() {
    return numberOfDays;
  }
 
  public PBSJob call() throws Throwable {
    final CommandOutput commandOutput = PBS.traceJob(jobId, this.numberOfDays);
    return new PBSJob(jobId, commandOutput.getOutput(), commandOutput.getError());
  }
View Full Code Here

Examples of org.cyclopsgroup.jmxterm.io.CommandOutput

        else
        {
            verboseLevel = null;
        }

        CommandOutput output;
        if ( StringUtils.equals( options.getOutput(), CliMainOptions.STDOUT ) )
        {
            output = new PrintStreamCommandOutput( System.out, System.err );
        }
        else
        {
            File outputFile = new File( options.getOutput() );
            output = new FileCommandOutput( outputFile );
        }
        try
        {
            CommandInput input;
            if ( options.getInput().equals( CliMainOptions.STDIN ) )
            {
                if ( options.isNonInteractive() )
                {
                    input = new InputStreamCommandInput( System.in );
                }
                else
                {
                    ConsoleReader consoleReader = new ConsoleReader( System.in, System.err );
                    final FileHistory history = new FileHistory(
                        new File(System.getProperty("user.home"), ".jmxterm_history"));
                    consoleReader.setHistory(history);
                    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
                    {
                        @Override
                        public void run()
                        {
                            try
                            {
                                history.flush();
                            }
                            catch (IOException e)
                            {
                                System.err.println("Failed to flush command history! " + e);
                            }
                        }
                    }));
                    input = new JlineCommandInput( consoleReader, COMMAND_PROMPT );
                }
            }
            else
            {
                File inputFile = new File( options.getInput() );
                if ( !inputFile.isFile() )
                {
                    throw new FileNotFoundException( "File " + inputFile + " is not a valid file" );
                }
                input = new FileCommandInput( new File( options.getInput() ) );
            }
            try
            {
                CommandCenter commandCenter = new CommandCenter( output, input );
                if ( input instanceof JlineCommandInput )
                {
                    ( (JlineCommandInput) input ).getConsole().addCompleter(new ConsoleCompletor(commandCenter));
                }
                if ( options.getUrl() != null )
                {
                    Map<String, Object> env;
                    if ( options.getUser() != null )
                    {
                        env = new HashMap<String, Object>( 1 );
                        String password = options.getPassword();
                        if ( password == null )
                        {
                            password = input.readMaskedString( "Authentication password: " );
                        }
                        String[] credentials = { options.getUser(), password };
                        env.put( JMXConnector.CREDENTIALS, credentials );
                    }
                    else
                    {
                        env = null;
                    }
                    commandCenter.connect( SyntaxUtils.getUrl( options.getUrl(), commandCenter.getProcessManager() ),
                                           env );
                }
                if ( verboseLevel != null )
                {
                    commandCenter.setVerboseLevel( verboseLevel );
                }
                if ( verboseLevel != VerboseLevel.SILENT )
                {
                    output.printMessage( "Welcome to JMX terminal. Type \"help\" for available commands." );
                }
                String line;
                int exitCode = 0;
                int lineNumber = 0;
                while ( ( line = input.readLine() ) != null )
                {
                    lineNumber++;
                    if ( !commandCenter.execute( line ) && options.isExitOnFailure() )
                    {
                        exitCode = -lineNumber;
                        break;
                    }
                    if ( commandCenter.isClosed() )
                    {
                        break;
                    }
                }
                commandCenter.close();
                return exitCode;
            }
            finally
            {
                input.close();
            }
        }
        finally
        {
            output.close();
        }
    }
View Full Code Here

Examples of org.jnode.shell.io.CommandOutput

                    holders = tmp;
                }

                CommandIOHolder stream;
                CommandInput in;
                CommandOutput out;
                switch (redir.getRedirectionType()) {
                    case REDIR_DLESS:
                    case REDIR_DLESSDASH:
                        String here = redir.getHereDocument();
                        if (redir.isHereDocumentExpandable()) {
                            here = dollarBacktickExpand(here).toString();
                        }
                        in = new CommandInput(new StringReader(here));
                        stream = new CommandIOHolder(in, true);
                        break;

                    case REDIR_GREAT:
                        try {
                            File file = new File(redir.getArg().getText());
                            if (isNoClobber() && file.exists()) {
                                throw new ShellException("File already exists");
                            }
                            out = new CommandOutput(new FileOutputStream(file));
                            stream = new CommandIOHolder(out, true);
                        } catch (IOException ex) {
                            throw new ShellException("Cannot open output file", ex);
                        }
                        break;

                    case REDIR_CLOBBER:
                    case REDIR_DGREAT:
                        try {
                            FileOutputStream tmp = new FileOutputStream(redir.getArg().getText(),
                                    redir.getRedirectionType() == REDIR_DGREAT);
                            stream = new CommandIOHolder(new CommandOutput(tmp), true);
                        } catch (IOException ex) {
                            throw new ShellException("Cannot open output file", ex);
                        }
                        break;
View Full Code Here

Examples of org.jnode.shell.io.CommandOutput

        if (capture == null) {
            bindShell(shell);
            myContext = this.context;
        } else {
            myContext = new BjorneContext(this);
            myContext.setIO(1, new CommandOutput(capture), true);
        }
        BjorneTokenizer tokens = new BjorneTokenizer(reader);
        // (Save the current parser and reader objects in the case where we are called
        // recursively ... to interpret a back-tick command.)
        BjorneParser savedParser = this.parser;
View Full Code Here

Examples of org.jnode.shell.io.CommandOutput

            Pipeline pipe = pipes.get(name);
            if (pipe == null) {
                pipe = new Pipeline();
                pipes.put(name, pipe);
            }
            return new CommandOutput(pipe.createSource());
        }
    }
View Full Code Here

Examples of org.jnode.shell.io.CommandOutput

                throw new ShellInvocationException("cannot open '" +
                        desc.fromFileName.text + "': " + ex.getMessage());
            }
            try {
                if (desc.toFileName != null) {
                    out = new CommandOutput(new FileOutputStream(desc.toFileName.text));
                }
            } catch (IOException ex) {
                throw new ShellInvocationException("cannot open '" +
                        desc.toFileName.text + "': " + ex.getMessage());
            }
View Full Code Here

Examples of org.jnode.shell.io.CommandOutput

                            desc.fromFileName.text + "': " + ex.getMessage());
                }
                try {
                    // redirect to
                    if (desc.toFileName != null) {
                        out = new CommandOutput(new FileOutputStream(desc.toFileName.text));
                        desc.openedStreams.add(out);
                    }
                } catch (IOException ex) {
                    throw new ShellInvocationException("cannot open '" +
                            desc.toFileName + "': " + ex.getMessage());
                }
                if (stageNo > 0) {
                    // pipe from
                    if (pipeOut != null) {
                        // the previous stage is sending stdout to the pipe
                        if (in == CommandLine.DEFAULT_STDIN) {
                            // this stage is going to read from the pipe
                            PipedInputStream pipeIn = new PipedInputStream();
                            try {
                                pipeIn.connect(pipeOut);
                            } catch (IOException ex) {
                                throw new ShellInvocationException(
                                        "Problem connecting pipe", ex);
                            }
                            in = new CommandInput(pipeIn);
                            desc.openedStreams.add(in);
                        } else {
                            // this stage has redirected stdin from a file ...
                            // so go back and replace the previous stage's
                            // pipeOut with devnull
                            CommandDescriptor prev = descs.get(stageNo - 1);
                            CommandIO[] prevIOs = prev.commandLine.getStreams();
                            try {
                                pipeOut.close();
                            } catch (IOException ex) {
                                // squash
                            }
                            prevIOs[Command.STD_OUT] = CommandLine.DEVNULL;
                        }
                    } else {
                        // the previous stage has explicitly redirected stdout
                        if (in == CommandLine.DEFAULT_STDIN) {
                            // this stage hasn't redirected stdin, so we need to
                            // give it a NullInputStream to suck on.
                            in = CommandLine.DEVNULL;
                        }
                    }
                }
                if (stageNo < nosStages - 1) {
                    // this stage is not the last one, and it hasn't redirected
                    // its stdout, so it will write to a pipe
                    if (out == CommandLine.DEFAULT_STDOUT) {
                        pipeOut = new PipedOutputStream();
                        out = new CommandOutput(new PrintStream(pipeOut));
                        desc.openedStreams.add(out);
                    }
                }
                desc.commandLine.setStreams(new CommandIO[] {in, out, err, CommandLine.DEFAULT_STDERR});
                try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.