Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid reentrance when in printReplacement
hs.ipc replaces the print function with one that calls the original, but also sends anything that print prints to any of the remote connections. If you have debugging enabled, that means that the moment the remote connection is created, a bunch of print statements are sent to the this connection. The problem I had is that my use of hs (command) was simply to send a message to the screen: warning () { hs -c "hs.alert.show('$1')" > /dev/null echo "$1" } The connection was so ephemeral, than I frequently got errors (related to the client no long existing) which were tried to be send to the client... so I ended with the following messages: 2023-12-31 22:00:02: 22:00:02 ERROR: LuaSkin: hs.ipc callback is being called recursively. Check your callback function, it is triggering further IPC messages. This message was triggered after reaching 5 recursive callbacks. This code avoid recursion for the same IPC client by keeping a counter of how many times the client has entered the critical region.
- Loading branch information