StdIn for shell commands

kanaida

Active Member
Licensed User
Longtime User
I use shell commands for almost anything advanced. So far reading the output has been enough as the commands were triggered by the user.

Now I have a particular situation in which I need to use the StdIn buffer to directly send a command to the shell, read it's output, and leave that shell there waiting for new commands without creating a new shell. In my case because i'm using a service to run a command every so often and since it's a root command it keeps popping up one of those "Superuser Access Granted" more than once. Due to how this app will work though, that will just use up more resources than it has to and plague people with toasted messages.

So basically I need to:

1) create a new shell object, elevate using 'su'
2) send commands periodically, reading the incremental output
3) release it when the service is stopped, close off the shell.

If I had support for StdIn buffer and the usual console functions this would be possible. I know it's a bit advanced but it would help quite a bit because it would allow us to make things such as the android terminal app on the market.
 
Top