Closed cwillisf closed 5 years ago
I'd like to help test this, so I tried by doing the following:
1) Run localhost:8601 on one browser tab 2) Connect to micro:bit over Scratch Link 3) Run localhost:8601 on another tab 4) Attempt to connect to micro:bit over Scratch Link again
But nothing happened, no error, and the second tab couldn't find the micro:bit anyway. Is there some other, better way to observe/trigger the error you are trying to fix?
@evhan55 sorry! I've added testing steps above :)
I have tested this on Mac, but I believe I am not seeing the new error window.
Here are my steps:
1) Check out this branch
2) run sudo make
in the macOS
folder
3) Launch 'Scratch Link' in the dist
folder
4) Check that 'Scratch Link' version is new:
Scratch Link 1.1.14 d96e6e9
macOS Version 10.14.1 (Build 18B75)
5) Try to launch 'Scratch Link' in the dist
folder again
Nothing happens, just as with Scratch Link 1.1.11 I do not see a new error window Maybe I am testing incorrectly?
@evhan55 sorry, I didn't realize this before but apparently macOS (or maybe Electron when running on macOS) has some built-in protection for opening an app twice. I'd been launching from a terminal and through VS Code so I didn't run into the problem :p
Anyway, I've updated the testing steps above to include a workaround.
Thanks! It worked this time after opening it via Terminal twice on Mac OS like you said:
Some further notes:
Address already in use!
Scratch Link was unable to start because port 20110 is already in use. This means Scratch Link is already running, or another application is using that port.
This application will now exit.
Just to clarify, the reason to start Scratch Link from the terminal is that macOS itself prevents running two copies of the same app bundle. By starting one of them from the console it's possible to bypass this. The second instance of Scratch Link can be opened normally and should display the error message.
I do like your text a bit better than mine, though :)
Resolves
Resolves #100
Proposed Changes
If the WebSocket library reports that it could not bind its port because the port is already in use, display a message and quit gracefully.
Reason for Changes
Currently Scratch Link throws an exception (crashes) in this situation without providing any user feedback. Out of the small number of sessions which crash, this is by far the most common cause of a crash on Windows and the issue affects the macOS build as well.
How to test
open "Scratch Link.app/Contents/MacOS/scratch-link"
to ensure that the OS will let you launch the second copy later.Notes
I'm open to suggestions on the text for the error message. This is my first draft: