five-server icon indicating copy to clipboard operation
five-server copied to clipboard

Open default browser loop

Open johnnesky opened this issue 1 year ago • 0 comments

If I run five-server with the open arg in a context where no web browser is available (a remote headless ubuntu server), the result is an infinite loop of printing out:

Could not open browser "default". Trying the default browser next.

Of course I could just set the open arg to false, but if I have a package.json file with an npm script designed to run on an end-user machine, and I happen to run this same script from a headless remote machine, it would be nice if it didn't have an infinite loop and just gave up more gracefully.

In my case, I would prefer that five-server continues to serve the content even in the event that it fails to open a browser, maybe with a warning message printing out the intended URL so that you could copy and paste it to manually open a browser, so that I could use the same script in both contexts. But I suppose that ending the job with an error code would be a reasonable behavior too unless open is set to false.

EDIT: I ended up setting up my script so that I could pass a "--headless" argument to it to control whether it opens a browser, and I'm satisfied with that, so don't worry about me. But still, the infinite loop isn't a good experience and should probably be addressed.

johnnesky avatar Jul 16 '24 03:07 johnnesky