Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Windows not opening browser or any client application without wait: true or setting a long timeout #298

Open
MathijsVerbeeck opened this issue Feb 20, 2023 · 2 comments

Comments

@MathijsVerbeeck
Copy link

Hi

I am currently having an issue when using open when simply opening a URL on Windows. I use the following code:

const open = require('open');
const result = await open('https://google.be/');

This will run the code, but the browser will not open. I have noticed that, when the code takes longer to execute, by for example adding a for loop that takes +- 5 seconds to run, that the browser will in fact open and it will work.

I have also noticed, that by adding { wait: true }, it will also start working, but that is not an option because when testing it on my macbook it will explicitly wait until the entire Chrome process has closed.

Is there any chance that you could have a look at this?

Thanks!
Mathijs

@MathijsVerbeeck MathijsVerbeeck changed the title Issue: Windows not opening browser or any client application without wait: true Issue: Windows not opening browser or any client application without wait: true or setting a long timeout Feb 20, 2023
@milanholemans
Copy link

milanholemans commented Feb 21, 2023

Giving some more context here, we are trying to use open in an async function.

The code looks something like this:

public async commandAction()Promise<void> {
   ...
   const open = require('open');
   await open('https://google.com/');
}

The problem is that we promise of our function is being resolved before the browser opens. Due to this, the browser will actually never open.

If we add some time consuming tasks after await open(...) is called, the browser will open after a few seconds.

Thank you for your help.

@MathijsVerbeeck
Copy link
Author

@sindresorhus Do you have any idea / update regarding this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants