rien / reStream

Stream your reMarkable screen over SSH.
MIT License
732 stars 56 forks source link

restream never shuts down on the reMarkable #103

Open frederik-elwert opened 5 months ago

frederik-elwert commented 5 months ago

When launching reStream.sh on the host, the corresponding restream process is started on the reMarkable. But when closing the window on the host, the process still runs on the remarkable. Since it has a quite high CPU load, this causes the battery of the reMarkable to deplete quickly.

I saw in the reStream.sh that it’s supposed to kill the restream process in the end, but that does not seem to happen.

So I think there are two scenarios:

Would it be possible to detect that second case and also terminate the process?

rien commented 5 months ago

We currently trap signals related to exiting and then kill the process running on the reMarkable: https://github.com/rien/reStream/blob/006d83e9b80fb2f3dd9db2330cce5e967d3df51a/reStream.sh#L124-L129

We are probably missing an exit signal (probably SIGPIPE or SIGCHLD), so detecting which signal it is and adding it would probably resolve the issue.

However, I also think we should be able to detect this in the process running on the reMarkable itself by looking whether the stdin and/or stdout channels are still being read from.