Stop the app on the remote device when the user stops it from host machine
I love your snapp_cli app, thank you. One issue, when I stop the app from my PC, the debugger disconnects but the app continues to run on the RPi. Is there a way to cleanly stop the app running? Thanks.
Hey @berkobob Happy to hear it is useful for you.
I will investigate about this.
I guess it's not possible from the flutter side, but maybe we can do a trick and kill the app by app ID.
I will let you know about possibilities.
Any luck with this? I'm having to reboot the pi each time because I don't know the name (or number) of the process to kill. Thanks!
Unfortunately, I didn't manage to check this issue.
you can find the app ID with this command
app_pid=$(pgrep -f "$app_command")
app_command=/tmp/\${appName}/build/linux/arm64/debug/bundle/\${appName}
If you want to work on this you can add this line in your custom_devices.json file after the line we lauch the app
That works, thank you.
@berkobob Can you share the final solution that you use?
I want add a update for it
I find the process ID as you showed me and then kill the process.
Alright,
If I get it right, you did this process manually right?
You did not change the custom_devices.json file
No, I didn't.
Thanks @berkobob
I think I may have found a solution. Adding the -tt flag to the ssh command forces the allocation of a PTY (pseudoterminal). This seems to ensure that the flutter-pi process on the target device receives a SIGHUP signal when disconnecting, which should allow it to shut down properly.