-
public abstract class Shell.Job
-
-
Method Summary
Modifier and Type Method Description abstract Shell.Jobto(@Nullable() List<String> stdout)Store output of STDOUT to a specific list. abstract Shell.Jobto(@Nullable() List<String> stdout, @Nullable() List<String> stderr)Store output of STDOUT and STDERR to specific lists. abstract Shell.Jobadd(@NonNull() Array<String> cmds)Add a new operation running commands. abstract Shell.Jobadd(@NonNull() InputStream in)Add a new operation serving an InputStream to STDIN. abstract Shell.Resultexec()Execute the job immediately and returns the result. final voidsubmit()Submit the job to an internal queue to run in the background.The result will be omitted. final voidsubmit(@Nullable() Shell.ResultCallback cb)Submit the job to an internal queue to run in the background.The result will be returned with a callback running on the main thread. abstract voidsubmit(@Nullable() Executor executor, @Nullable() Shell.ResultCallback cb)Submit the job to an internal queue to run in the background.The result will be returned with a callback executed by the provided executor. abstract Future<Shell.Result>enqueue()Submit the job to an internal queue to run in the background. -
-
Method Detail
-
to
@NonNull() abstract Shell.Job to(@Nullable() List<String> stdout)
Store output of STDOUT to a specific list.
- Parameters:
stdout- the list to store STDOUT.
-
to
@NonNull() abstract Shell.Job to(@Nullable() List<String> stdout, @Nullable() List<String> stderr)
Store output of STDOUT and STDERR to specific lists.
- Parameters:
stdout- the list to store STDOUT.stderr- the list to store STDERR.
-
add
@NonNull() abstract Shell.Job add(@NonNull() Array<String> cmds)
Add a new operation running commands.
- Parameters:
cmds- the commands to run.
-
add
@NonNull() abstract Shell.Job add(@NonNull() InputStream in)
Add a new operation serving an InputStream to STDIN.
This is NOT executing the script like
{@code sh script.sh}.This is similar to sourcing the script ({@code . script.sh}) as theraw content of the script is directly fed into STDIN. If you call{@code exit}in the script, the shell will be killed and thisshell instance will no longer be alive!- Parameters:
in- the InputStream to serve to STDIN.The stream will be closed after consumption.
-
exec
@NonNull() abstract Shell.Result exec()
Execute the job immediately and returns the result.
-
submit
final void submit()
Submit the job to an internal queue to run in the background.The result will be omitted.
-
submit
final void submit(@Nullable() Shell.ResultCallback cb)
Submit the job to an internal queue to run in the background.The result will be returned with a callback running on the main thread.
- Parameters:
cb- the callback to receive the result of the job.
-
submit
abstract void submit(@Nullable() Executor executor, @Nullable() Shell.ResultCallback cb)
Submit the job to an internal queue to run in the background.The result will be returned with a callback executed by the provided executor.
- Parameters:
executor- the executor used to handle the result callback event.cb- the callback to receive the result of the job.
-
enqueue
@NonNull() abstract Future<Shell.Result> enqueue()
Submit the job to an internal queue to run in the background.
-
-
-
-