@Deprecated public class SystemCommand extends Object
Constructor and Description |
---|
SystemCommand(File workdir,
String... command)
Deprecated.
Creates a command.
|
SystemCommand(String... command)
Deprecated.
Creates a command for which the execution will be in the working
directory of the current process.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Deprecated.
Aborts the running command.
|
void |
addErrorListener(com.norconex.commons.lang.io.IStreamListener listener)
Deprecated.
Adds an error (STDERR) listener to this system command.
|
void |
addOutputListener(com.norconex.commons.lang.io.IStreamListener listener)
Deprecated.
Adds an output (STDOUT) listener to this system command.
|
int |
execute()
Deprecated.
Executes the given command and returns only when the underlying process
stopped running.
|
int |
execute(boolean runInBackground)
Deprecated.
Executes the given system command.
|
String[] |
getCommand()
Deprecated.
Gets the command to be run.
|
String |
getDescription()
Deprecated.
Gets the description for this command.
|
File |
getWorkdir()
Deprecated.
Gets the command working directory.
|
boolean |
isRunning()
Deprecated.
Returns whether the command is currently running.
|
void |
removeErrorListener(com.norconex.commons.lang.io.IStreamListener listener)
Deprecated.
Removes an error (STDERR) listener.
|
void |
removeOutputListener(com.norconex.commons.lang.io.IStreamListener listener)
Deprecated.
Removes an output (STDOUT) listener.
|
void |
setDescription(String description)
Deprecated.
Sets the description for this command.
|
String |
toString()
Deprecated.
Returns the command to be executed.
|
public SystemCommand(String... command)
command
- the command to runpublic SystemCommand(File workdir, String... command)
command
- the command to runworkdir
- specifies a working directory (default inherits
the working directory of the current process.public String[] getCommand()
public String getDescription()
public void setDescription(String description)
description
- command descriptionpublic File getWorkdir()
public void addErrorListener(com.norconex.commons.lang.io.IStreamListener listener)
listener
- command error listenerpublic void removeErrorListener(com.norconex.commons.lang.io.IStreamListener listener)
listener
- command error listenerpublic void addOutputListener(com.norconex.commons.lang.io.IStreamListener listener)
listener
- command output listenerpublic void removeOutputListener(com.norconex.commons.lang.io.IStreamListener listener)
listener
- command output listenerpublic boolean isRunning()
true
if runningpublic void abort()
public int execute() throws InterruptedException, IOException
InterruptedException
- problem executing commandIOException
- problem executing commandpublic int execute(boolean runInBackground) throws InterruptedException, IOException
AsyncJobGroup
).runInBackground
- true
to runs the system command in
background.InterruptedException
- problem executing commandIOException
- problem executing commandCopyright © 2007–2021 Norconex Inc.. All rights reserved.