notly / roottools

Automatically exported from code.google.com/p/roottools
0 stars 0 forks source link

How to get access to input stream of program? #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I learn RootTools library for Android. And tried to use Python-program. I was 
able to run the program that:

String text = "busybox chroot /data/local/debian /usr/bin/python 
/usr/src/program.py";
Command command = new Command(0, text) {
   @Override
   public void output(int id, String line) {
      publishProgress(line);
   }
};
RootTools.getShell(true).add(command).waitForFinish();

But I do not know how to access the input stream of the program. This is 
necessary to continue the program.
i.e.
In console, I work with this Python-program that:

root@localhost:/# python program.py
Program started. Enter command:
>> command
result
>> anycommand
anyresult

But if I try to do this with RootTools

root@localhost:/# python program.py
Program started. Enter command:
root@localhost:/#

I hope that I clearly explained the situation(Sorry for my english)
Thanks

What version of the product are you using? On what operating system?
2.6

Original issue reported on code.google.com by imhol...@gmail.com on 9 Mar 2013 at 9:45

GoogleCodeExporter commented 8 years ago
You can try this:
<code>
String text = "busybox chroot /data/local/debian /usr/bin/python 
/usr/src/program.py";
RootTools.getShell(true).add(new Command(0,//
        text,//
        Command1,//
        Command2,//
        Command3,//
        Command4,//
        Command4) {
            @Override
            public void output(int pId, String pLine) {
                publishProgress(pLine);
            }
        }).waitForFinish();
</code>
All commands will be executed sequentially.
RootTools, does not support interactive communication with the process.(This 
assumption I made based on the source code. But this assumption may be wrong.)

I would like to ask the developers. Do you plan to implement to interact with 
the running process? This capability would be very useful.

Original comment by CkopII...@gmail.com on 11 Mar 2013 at 8:34

GoogleCodeExporter commented 8 years ago
Thank you for answer. Yes, I wanted to do program with communication with the 
process.

Original comment by imhol...@gmail.com on 11 Mar 2013 at 2:03