Package org.snpeff.osCmd

# Class OsCmdRunner

java.lang.Object
java.lang.Thread
org.snpeff.osCmd.OsCmdRunner

All Implemented Interfaces:
  `Runnable`

public class OsCmdRunner extends Thread
Run an OS command as a thread

Author:
  pcingola

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Thread

`Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler`

## Field Summary

### Fields inherited from class java.lang.Thread

`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

## Constructor Summary

Constructors
Constructor
Description
`OsCmdRunner(String jobId, String[] osCmdStr)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close (kill) command
`void`
`finish()`
Stop execution of this thread
`long`
`getDefaultWaitTime()`
`String`
`getError()`
`int`
`getExitValue()`
`String`
`getHead()`
`String`
`getHeadStderr()`
`String`
`getJobId()`
`ExecuteOsCommand`
`getOsCmd()`
`int`
`getProgress()`
`String`
`getStderr()`
`String`
`getStdout()`
`boolean`
`isDone()`
Has this runner finished?
`boolean`
`isExecuting()`
`void`
`run()`
`static boolean`
`runIfNotExists(String[] opts, String outputFile, boolean redirectToOutput)`
Run an OS command only if the output files does not exists.
`boolean`
`runIfNotExists(String outputFile, boolean redirectToOutput)`
Run a command only if 'outputFile' does not exist
`void`
`setDefaultWaitTime(long defaultWaitTime)`
`void`
`setSaveStd(boolean save)`
`String`
`toString()`

### Methods inherited from class java.lang.Thread

`activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, yield`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### OsCmdRunner

public OsCmdRunner(String jobId, String[] osCmdStr)

## Method Details

### runIfNotExists

public static boolean runIfNotExists(String[] opts, String outputFile, boolean redirectToOutput)
Run an OS command only if the output files does not exists. opts[0] : OS Command opts[1] ... opts[N] : Command line options outputFile : Where the results are stored (if the file exists, the command is NOT run) redirect : If 'redirect=true' then run "command > outputFile" (i.e. redirect STDOUT to 'outputFile'). Output is assumed to be binary.

Parameters:
  `opts` -
  `outputFile` -
  `redirectToOutput` -
Returns:
  true if command executed OK or outputFile exists

### close

public void close()
Close (kill) command

### finish

public void finish()
Stop execution of this thread

### getDefaultWaitTime

public long getDefaultWaitTime()

### getError

public String getError()

### getExitValue

public int getExitValue()

### getHead

public String getHead()

### getHeadStderr

public String getHeadStderr()

### getJobId

public String getJobId()

### getOsCmd

public ExecuteOsCommand getOsCmd()

### getProgress

public int getProgress()

### getStderr

public String getStderr()

### getStdout

public String getStdout()

### isDone

public boolean isDone()
Has this runner finished?

Returns:

### isExecuting

public boolean isExecuting()

### run

public void run()

Specified by:
  `run` in interface `Runnable`
Overrides:
  `run` in class `Thread`

### runIfNotExists

public boolean runIfNotExists(String outputFile, boolean redirectToOutput)
Run a command only if 'outputFile' does not exist

Parameters:
  `outputFile` -
  `redirectToOutput` -
Returns:

### setDefaultWaitTime

public void setDefaultWaitTime(long defaultWaitTime)

### setSaveStd

public void setSaveStd(boolean save)

### toString

public String toString()

Overrides:
  `toString` in class `Thread`