Package org.sonarsource.nodejs
Interface ProcessWrapper
-
- All Known Implementing Classes:
ProcessWrapperImpl
@ScannerSide @SonarLintSide(lifespan="MULTIPLE_ANALYSES") public interface ProcessWrapperThis interface provides thin wrapper around Java ProcessBuilder and related APIs. The goal is to make them testable across different OS flavors. It also handles the issue of consuming stdout and stderr of started process in an asynchronous way using a daemon thread
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddestroyForcibly(Process process)intexitValue(Process process)Stringgetenv(String name)voidinterrupt()booleanisMac()booleanisWindows()ProcessstartProcess(List<String> commandLine, Map<String,String> env, Consumer<String> outputConsumer, Consumer<String> errorConsumer)booleanwaitFor(Process process, long timeout, TimeUnit unit)
-
-
-
Method Detail
-
startProcess
Process startProcess(List<String> commandLine, Map<String,String> env, Consumer<String> outputConsumer, Consumer<String> errorConsumer) throws IOException
- Throws:
IOException
-
waitFor
boolean waitFor(Process process, long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
interrupt
void interrupt()
-
destroyForcibly
void destroyForcibly(Process process)
-
isMac
boolean isMac()
-
isWindows
boolean isWindows()
-
exitValue
int exitValue(Process process)
-
-