Skip to content

app.commandLine.getSwitchValue throws on uppercase letters #45991

Closed

Description

@Lemonexe

Preflight Checklist

Electron Version

35.0.1

What operating system(s) are you using?

Ubuntu, Windows

Operating System Version

Ubuntu 24.04.2 LTS
Windows 10 22H2, build 19045.5608

What arch are you using?

x64

Last Known Working Electron version

34.3.2

Expected Behavior

app.commandLine.getSwitchValue('switchUpperCase') returns the value of the switch.

Actual Behavior

app.commandLine.getSwitchValue('switchUpperCase') throws native code exception (with no JS stack trace).
Linux:

[49418:0312/142211.150768:FATAL:command_line.cc(387)] Check failed: IsSwitchNameValid(switch_string). 
/my_local_path/node_modules/electron/dist/electron exited with signal SIGTRAP

Windows (difference only in the exception handling):

[3392:0312/163241.720:FATAL:command_line.cc(387)] Check failed: IsSwitchNameValid(switch_string).
[3392:0312/163241.720:ERROR:crashpad_client_win.cc(869)] not connected

See gist README for more details.

Testcase Gist URL

https://gist.github.com/Lemonexe/4eb8ceb22a0741e65ff07294eba50075

Additional Information

I tried to find any documentation for this change, in case this was a planned breaking change, but did not find anything.

Activity

  1. added theissue type on Mar 12, 2025
  2. added
    has-repro-gist
    on Mar 12, 2025
  3. moved this to 👀 Unsorted Items in 35-x-yon Mar 12, 2025
  4. added
    bug/regression ↩️
    on Mar 12, 2025
  5. nikwen commented on Mar 12, 2025

    @nikwen
    Member

    Thanks for reporting! Is this limited to Linux or does it also happen on Windows or macOS?

  6. Lemonexe commented on Mar 12, 2025

    @Lemonexe
    Author

    @nikwen I've also reproduced it on Win 10 and updated the issue description accordingly 🙂
    I do not have macOS available to confirm it also there.

  7. nikwen commented on Mar 12, 2025

    @nikwen
    Member

    Thanks! Just to be clear: As far as I understand, commandLine exists to enable and disable Chromium switches. It's not supposed to replace process.argv.

    Are there any Chromium switches that contain uppercase letters?

  8. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 35-x-yon Mar 12, 2025
  9. changed the title [-]app.commandLine.getSwitchValue throws on uppercase letters[/-] [+]`app.commandLine.getSwitchValue` throws on uppercase letters[/+] on Mar 12, 2025
  10. Lemonexe commented on Mar 12, 2025

    @Lemonexe
    Author

    @nikwen Not that I know of, Chromium seems to use only kebab case for its switches. Though applications built on Electron can define their own custom switches – that's how I found out.
    But yeah, it's definitely a minor issue, as we can use raw process.argv directly, which is the solution I used.
    Maybe it was wrong to use app.commandLine.getSwitchValue for custom switches in the first place, as you indicate. Got it.
    So then there is maybe no need to support uppercase chars... idk really, I just reported an undocumented change in observed behavior 🙂

  11. nikwen commented on Mar 12, 2025

    @nikwen
    Member

    We talked internally and everyone agreed that app.commandLine is meant for customizing Chromium arguments, not application-specific parameters.

    Still, @codebytere said she'd change the code to at least prevent it from crashing.

  12. deleted a comment from on Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

35-x-ybug 🪲bug/regression ↩️has-repro-gistplatform/all

Type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions