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

fix: app.relaunch loses args when execPath specified #35108

Merged
merged 4 commits into from Aug 8, 2022

Conversation

p120ph37
Copy link
Contributor

@p120ph37 p120ph37 commented Jul 27, 2022

I think this should fix #33686, but I didn't have a local toolchain to do the full build/test. However, CircleCI was nice enough to build this PR for me, and I tested the resulting Electron artifact using my gist from 33686, and it fixes the issue for me!

Description of Change

The change from bitwise to boolean "or"-operator in 1e37162 caused a short-circuit of the evaluation of a function-call with side-effects. This change pre-evaluates the functions and assigns the results to separate local variables to ensure the side-effects apply in all cases, then combines the variables with the short-circuit-able boolean operator in the conditional.

Fixes #33686

Checklist

Release Notes

Notes: Fixed an issue where app.relaunch loses args when execPath is specified.

Commit 1e37162 changed a bitwise-or operator to a boolean-or operator,
which altered the short-circuit behavior and skipped the side-effect
of populating the "args" variable.

This commit restores the original side-effect behavior, while still
using a boolean-or operator to keep the linter happy.

Addresses issue electron#33686
@welcome
Copy link

welcome bot commented Jul 27, 2022

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jul 27, 2022
@RaisinTen
Copy link
Member

I don't have a local toolchain to do the full build/test. Could someone please check this for me?

Maybe you could write a test with your gist and we'll know if your fix works if it passes on CI?

@codebytere
Copy link
Member

@p120ph37 please fill out the PR template you removed in order for us to continue reviewing this PR.

@p120ph37
Copy link
Contributor Author

@RaisinTen , I wasn't able to test initially, because I don't have a working build toolchain, but after filing this PR, I was able to use the CircleCI build output to test using my gist, and it solves the issue for me.

@codebytere , now that I've been able to actually test this code-change with the CircleCI output after the initial skeleton PR, I've filled in the full PR template.

@p120ph37 p120ph37 changed the title Fix app relaunch fix: app.relaunch loses args when execPath specified Jul 28, 2022
@RaisinTen
Copy link
Member

I wasn't able to test initially, because I don't have a working build toolchain, but after filing this PR, I was able to use the CircleCI build output to test using my gist, and it solves the issue for me.

That's good to know 👍. A test would still be beneficial though. It would prevent further regressions in the future.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 3, 2022
Copy link
Member

@RaisinTen RaisinTen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/19-x-y target/21-x-y PR should also be added to the "21-x-y" branch. labels Aug 4, 2022
@codebytere codebytere merged commit 91f9436 into electron:main Aug 8, 2022
@welcome
Copy link

welcome bot commented Aug 8, 2022

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Aug 8, 2022

Release Notes Persisted

Fixed an issue where app.relaunch loses args when execPath is specified.

@trop
Copy link
Contributor

trop bot commented Aug 8, 2022

I have automatically backported this PR to "19-x-y", please check out #35252

@trop
Copy link
Contributor

trop bot commented Aug 8, 2022

I have automatically backported this PR to "20-x-y", please check out #35253

@trop
Copy link
Contributor

trop bot commented Aug 8, 2022

I have automatically backported this PR to "21-x-y", please check out #35254

@trop trop bot added in-flight/20-x-y merged/21-x-y PR was merged to the "21-x-y" branch. and removed target/20-x-y target/21-x-y PR should also be added to the "21-x-y" branch. labels Aug 8, 2022
Dragon-S pushed a commit to Dragon-S/electron that referenced this pull request Aug 9, 2022
fix: app.relaunch loses args when execPath specified (electron#35108)

Co-authored-by: Aaron Meriwether <me@ameriwether.com>
mlaurencin pushed a commit that referenced this pull request Aug 31, 2022
fix: app.relaunch loses args when execPath specified (#35108)

Co-authored-by: Aaron Meriwether <me@ameriwether.com>
rzhao271 pushed a commit to rzhao271/electron that referenced this pull request Oct 10, 2022
fix: app.relaunch loses args when execPath specified (electron#35108)

Co-authored-by: Aaron Meriwether <me@ameriwether.com>
schetle pushed a commit to schetle/electron that referenced this pull request Nov 3, 2022
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/21-x-y PR was merged to the "21-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: app.relaunch loses args when execPath specified.
3 participants