-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndk-build: Return PID after launching the app #331
Conversation
.arg("am") | ||
.arg("start") | ||
.arg("-W") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's neat, I was wondering how this was implemented by @dvc94ch in x
, turns out to be a sleep-loop: https://github.com/cloudpeers/xbuild/blob/e0ebb50bfa78cfad61931bb30c70a624b85fdddd/xbuild/src/devices/adb.rs#L175-L186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably semi-smart to keep a loop so that duplicate PIDs for yet-to-exit app instances are not causing issues:
But IMO am start
should be able to emit the pid
instead of this hackery. Android Studio must also have a smart yet concise way of dealing with this, that isn't error-prone. Perhaps just outputting all the PIDs (--pid
is probably a coma-separated list or can be stacked), and we can combine that with a last timestamp filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the pid thing is good enough for now. Was seeing duplicate PIDs because one of my gdb
sessions got stuck and the processes couldn't get killed and detached even under root.
If we ever observe problems with it we'll make it more fallible or change it altogether.
Depends on #329 to apply cleanly.
Shows the process PID after launching. Requires
-W
as anam start
arg to wait for process completion to prevent a race condition. Having the PID is useful in a lot of cases, such as filtering logs withadb logcat --pid=...