libsuperuser icon indicating copy to clipboard operation
libsuperuser copied to clipboard

How to run command synchronously?

Open RHSaliya opened this issue 4 years ago • 0 comments

I want to run command libsupeuser library to access values after some actions are performed how can I do that?

Example:

    private final Shell.Interactive su = new Shell.Builder().useSU().open();
    su.addCommand("command", 0, (Shell.OnCommandResultListener2) (commandCode, exitCode, STDOUT, STDERR) -> {
          someBoolean = STDOUT.size() > 0;
     });
    return someBoolean;

here value of someBoolean is returned before it is evaluated.

RHSaliya avatar Feb 07 '21 08:02 RHSaliya