Stericson / RootTools

RootTools Library
1.6k stars 484 forks source link

Running a native process in the background causes issues. #78

Open hacker1024 opened 6 years ago

hacker1024 commented 6 years ago

When RootTools runs a command, it also sends an echo <token> command to the shell that runs after the command given. RootTools knows when a command is finished by watching standard output for this "token". When it sees the token, it assumes the command is finished. The problem is, that's not always the case. If I run a daemon program, the token will be echoed before the program ends. RootTools then thinks that daemon has ended. This causes all kinds of issues, especially with receiving command output.

Using a "token" like that is also an issue, because, unlikely as it is for a command to print the token (the token is currently F*D^W@#FGF), it still might and should be able to happen without causing any problems.

Stericson commented 6 years ago

Hi hacker,

RootTools/RootShell was never really intended to be able to monitor a long running process. Rather it was intended to be able to execute simple shell commands that would return a direct response for the user. I'm open to suggestions for a solution but I also have limited time to work on this project.

Additionally, in regards to the token, I agree with you but at the time this was developed (waaaaaaaay early in the android days) the token was the best option we had to achieve this and it's worked so well that it's just never been changed since.