Class NodeCommand
- java.lang.Object
-
- org.sonar.plugins.javascript.nodejs.NodeCommand
-
public class NodeCommand extends Object
Represents invocation of external NodeJS process. UseNodeCommandBuilder
to create instance of this class. Once created you can callstart()
to start external process,waitFor()
to wait until process terminates anddestroy()
to kill the process. Standard and error output are consumed asynchronously in separate threads and each line is supplied to the consumer set viaNodeCommandBuilder.outputConsumer(Consumer)
orNodeCommandBuilder.errorConsumer(Consumer)
. When no consumers are set, by default it will use logger to log output of external process - standard output at INFO level and error output at ERROR level.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NodeCommandBuilder
builder()
org.sonar.api.utils.Version
getActualNodeVersion()
void
start()
Start external NodeJS processString
toString()
int
waitFor()
Wait for external process to terminate
-
-
-
Method Detail
-
start
public void start()
Start external NodeJS process- Throws:
NodeCommandException
- when start of the external process fails
-
waitFor
public int waitFor()
Wait for external process to terminate- Returns:
- exit value of the external process
-
getActualNodeVersion
public org.sonar.api.utils.Version getActualNodeVersion()
-
builder
public static NodeCommandBuilder builder()
-
-