Examples of StringStreamConsumer


Examples of org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer

        cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );

        cl.addArguments( CommandLineUtils.translateCommandline( arguments ) );

        StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();

        StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        System.out.println( "Test command line: " + cl );

        int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, stderr );

        if ( debugExecute || exitValue != 0 )
        {
            System.err.println( "-----------------------------------------" );
            System.err.println( "Command line: " + cl );
            System.err.println( "Working directory: " + cl.getWorkingDirectory() );
            System.err.println( "-----------------------------------------" );
            System.err.println( "Standard output: " );
            System.err.println( "-----------------------------------------" );
            System.err.println( stdout.getOutput() );
            System.err.println( "-----------------------------------------" );

            System.err.println( "Standard error: " );
            System.err.println( "-----------------------------------------" );
            System.err.println( stderr.getOutput() );
            System.err.println( "-----------------------------------------" );
        }

        if ( exitValue != 0 )
        {
View Full Code Here

Examples of org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer

            public void consumeLine(String line) {
                log.info(line);
            }
        };
        if( !verbose ) {
            consumer = new StringStreamConsumer();
        }
        int rc = CommandLineUtils.executeCommandLine(cli, null, consumer, consumer);
        if( rc!=0 ) {
            if( !verbose ) {
                // We only display output if the command fails..
View Full Code Here

Examples of org.sonar.api.utils.command.StringStreamConsumer

  private void blame(final FileSystem fs, final InputFile inputFile, final BlameOutput output) {
    String filename = inputFile.relativePath();
    Command cl = createCommandLine(fs.baseDir(), filename);
    SvnBlameConsumer consumer = new SvnBlameConsumer(filename);
    StringStreamConsumer stderr = new StringStreamConsumer();
    int exitCode;
    try {
      exitCode = execute(cl, consumer, stderr);
    } catch (CommandException e) {
      // Unwrap CommandException
      throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new IllegalStateException(e.getCause());
    }
    if (exitCode != 0) {
      throw new IllegalStateException("The svn blame command [" + cl.toString() + "] failed: " + stderr.getOutput());
    }
    List<BlameLine> lines = consumer.getLines();
    if (lines.size() == inputFile.lines() - 1) {
      // SONARPLUGINS-3097 SVN do not report blame on last empty line
      lines.add(lines.get(lines.size() - 1));
View Full Code Here

Examples of org.sonar.api.utils.command.StringStreamConsumer

  private void blame(File baseDir, BlameOutput output, InputFile inputFile) {
    String filename = inputFile.relativePath();
    Command cl = createCommandLine(baseDir, filename);
    GitBlameConsumer consumer = new GitBlameConsumer(filename);
    StringStreamConsumer stderr = new StringStreamConsumer();

    int exitCode = execute(cl, consumer, stderr);
    if (exitCode != 0) {
      throw new IllegalStateException("The git blame command [" + cl.toString() + "] failed: " + stderr.getOutput());
    }
    List<BlameLine> lines = consumer.getLines();
    if (lines.size() == inputFile.lines() - 1) {
      // SONARPLUGINS-3097 Git do not report blame on last empty line
      lines.add(lines.get(lines.size() - 1));
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.