-
Notifications
You must be signed in to change notification settings - Fork 906
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
fix: buggy behaviour when launching debugger on macOS #771
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, but haven't tested yet. Can you please update the PR description?
@Taym95 can you verify this works for you as well? :)
logger.error('Google Chrome exited with error:', err); | ||
} | ||
}); | ||
return open(url, {app: [getChromeAppName()], wait: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test it, It's not working properly, still getting For a better debugging experience please install Google Chrome from
.
I don't think we need to use wait: true
here, from open
documentation:
wait
Type: boolean
Wait for the opened app to exit before fulfilling the promise.
If false it's fulfilled immediately when opening the app.
I think we need to use async/await with open, something like this?
async function launchChrome(url: string) {
const {err} = await open(url, {app: getChromeAppName()});
if (err) {
logger.error('Google Chrome exited with error:', err);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without wait: true
, it will not work as we need it to: no errors will be reported to the calling code and try/catch will not make any difference. Here is an extract from open
's code:
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
if (options.wait) {
return new Promise((resolve, reject) => {
subprocess.once('error', reject);
subprocess.once('close', exitCode => {
if (exitCode > 0) {
reject(new Error(`Exited with code ${exitCode}`));
return;
}
resolve(subprocess);
});
});
}
subprocess.unref();
return subprocess;
It seems to be working well with my modifications for me . :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry my bad, tested it again works great!
Summary:
Fixes #762
Test Plan: