pkulchenko / MobDebug

Remote debugger for Lua.
Other
889 stars 192 forks source link

Could not connect to localhost:8172: connection refused #83

Closed andy380743909 closed 9 months ago

andy380743909 commented 9 months ago

I am developing an app that can debug Lua scripts. I start a process that execute lua -e "require("mobdebug").listen()", and then start another process to run my lua code to be debugged. The code start with "require("mobdebug").start()". This may run into a race condition, if the debugger proccess setup the socket later than the proccess be debugged, this error happens. I know this is not the issue of this library, but maybe you guys know better than me about how to avoid this race condition.

andy380743909 commented 9 months ago

I have fixed it by monitor the output of the debugger process, when it output texts containing "Lua Remote Debugger\nRun the program you will to debug\n", then start the Lua script to be debugged. It just works.

pkulchenko commented 9 months ago

Thank you for the update! That's a good way to deal with that. You can also add a small delay between starting the (listening) controller and launching the application, but your approach may work even better. Let me know if you run into any other issues.