jetbrains.buildServer.agent.runner
Class LogLastLinesProcessListener

java.lang.Object
  extended by jetbrains.buildServer.agent.runner.ProcessListenerAdapter
      extended by jetbrains.buildServer.agent.runner.LogLastLinesProcessListener
All Implemented Interfaces:
java.util.EventListener, ProcessListener

public class LogLastLinesProcessListener
extends ProcessListenerAdapter

Process listener which is able to add last process's output lines to the build log.


Constructor Summary
LogLastLinesProcessListener(java.lang.String runnerName, BuildProgressLogger buildLogger, int maxSize)
           
 
Method Summary
 void onErrorOutput(java.lang.String text)
          process error output
 void onStandardOutput(java.lang.String text)
          process standard output
 void processFinished(int exitCode)
          Process finished, terminated or failed to start.
protected  boolean shouldLogLines(int exitCode)
          By defaults, return true iff process exit code is != 0
 
Methods inherited from class jetbrains.buildServer.agent.runner.ProcessListenerAdapter
processStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogLastLinesProcessListener

public LogLastLinesProcessListener(java.lang.String runnerName,
                                   BuildProgressLogger buildLogger,
                                   int maxSize)
Method Detail

onStandardOutput

public void onStandardOutput(@NotNull
                             java.lang.String text)
Description copied from interface: ProcessListener
process standard output

Specified by:
onStandardOutput in interface ProcessListener
Overrides:
onStandardOutput in class ProcessListenerAdapter
Parameters:
text - process stdout output text

onErrorOutput

public void onErrorOutput(@NotNull
                          java.lang.String text)
Description copied from interface: ProcessListener
process error output

Specified by:
onErrorOutput in interface ProcessListener
Overrides:
onErrorOutput in class ProcessListenerAdapter
Parameters:
text - process stderr output text

processFinished

public void processFinished(int exitCode)
Description copied from interface: ProcessListener
Process finished, terminated or failed to start. Called only if ProcessListener.processStarted(String, java.io.File) was called before

Specified by:
processFinished in interface ProcessListener
Overrides:
processFinished in class ProcessListenerAdapter
Parameters:
exitCode - resulting exit code of the process

shouldLogLines

protected boolean shouldLogLines(int exitCode)
By defaults, return true iff process exit code is != 0

Parameters:
exitCode - process exit code
Returns:
true if last lines should be added to build log, false otherwise