electron/docs/api/command-line-switches.md
Electron Bot 46f3491c7d
chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558)
* chore: bump chromium in DEPS to d5c9bf9e2a18fa508201a88e5803bec1d107b1ae

* chore: bump chromium in DEPS to 45f1316afae33e52c92480b34bf4f7fe4a7db898

* update patches

* WillCreateURLLoaderFactory now gets a ukm_source_id

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2346803

* ink_drop_visible_opacity -> GetInkDropVisibleOpacity

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415368

* chore: bump chromium in DEPS to ddb5b6db5e35ab1a7b5adbd9f15373af6c35ea2a

* 2418471: PDF Viewer update: Add missing aria-labels to various buttons.

https://chromium-review.googlesource.com/c/chromium/src/+/2418471

* update printing.patch given print settings mojoification

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2409467

* update patches

* content::BluetoothChooser::Event -> content::BluetoothChooserEvent

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2387901

* set_ink_drop_base_color -> SetInkDropBaseColor

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2419388

* chore: bump chromium in DEPS to ecf7c9ee830d4d85f300b461a2fa13aa40c79a4c

* update patches

* gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2418568

* remove ContentSettingsObserver::AllowStorage()

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2401847

* service_manager::kCrashDumpSignal -> kCrashDumpSignal

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073

* chore: bump chromium in DEPS to abdb7ebe5f8c8328b8f435283df90d0a3ecff7bd

* chore: bump chromium in DEPS to 2a7e138ab1066534ceb2622e8a9d2c8ebf574215

* chore: bump chromium in DEPS to ab1884e75ced904e4276851eb4e1ad89919ca93b

* chore: bump chromium in DEPS to a12413902380dcc2a73ac74d582328280a8af686

* Fixup printing patch

https://chromium-review.googlesource.com/c/chromium/src/+/2428623

* Fixup OSR patch

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Make ExtensionURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2357523

* Add deprecated_default_sources_assignment_filter variable

https://chromium-review.googlesource.com/c/chromium/src/+/2416496

* Fixup patch indices

* Remove several references to BrowserPlugin from content

https://chromium-review.googlesource.com/c/chromium/src/+/2401031

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Add DragOperation and AllowedDragOperations Mojo types

https://chromium-review.googlesource.com/c/chromium/src/+/2196167

* chore: bump chromium in DEPS to 378450342cf6aa160663d0ce3a178a11b570c25a

* Fixup patch indices

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Add DragOperation and AllowedDragOperations Mojo types

https://chromium-review.googlesource.com/c/chromium/src/+/2196167

* 2426564: Remove global sources assignment filter value

https://chromium-review.googlesource.com/c/chromium/src/+/2426564

* Fixup blink_local_frame.patch

* [XProto] Remove a subset of ui/gfx/x/x11.h

https://chromium-review.googlesource.com/c/chromium/src/+/2430328

* Fixup patch indices

* Remove several references to BrowserPlugin from content

https://chromium-review.googlesource.com/c/chromium/src/+/2401031

* Remove lossy ConvertSizeToPixel() methods

https://chromium-review.googlesource.com/c/chromium/src/+/2419534

* serial: Use USB driver name to disambiguate ports

https://chromium-review.googlesource.com/c/chromium/src/+/2413176

* Remove set_sources_filter import

* Fix ModMask usage

* [XProto] Remove usage of all Xlib headers

https://chromium-review.googlesource.com/c/chromium/src/+/2392140

* [XProto] Remove usage of Xlib Visuals

https://chromium-review.googlesource.com/c/chromium/src/+/2429933

* Skip Angle manifest file

https://chromium-review.googlesource.com/c/angle/angle/+/2425197

* Add whole src\third_party\angle\.git directory

This directory is needed in order to properly generate gen/angle/angle_commit.h

* [libvpx] Fix HighBD config on Windows ARM64

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* update patches

* fix: correct calling convention for Windows on Arm

https://chromium-review.googlesource.com/c/v8/v8/+/2440717

* Add third_party/angle/.git to the archive before adding the rest of the source

* fixup source caching on Windows

* Fixup erroneous close paren

* fixup for goma issues

* This should work

* chore: bump chromium roll manually

https://chromium-review.googlesource.com/c/chromium/src/+/2435142

This landed the day after we paused roller-bot and may resolve the
visibility test flakes that we're seeing. h/t to @jkleinsc for
finding this with me.

* chore: remove obsoleted cherry-pick fix for libvpx

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* chore: remove obsoleted cherry-pick libvpx patch

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* chore: re-export patches

* chore: add tracer comment to visibility-stat-spec.

The line numbers between the source and the CI runs don't seem to match
up, so this temp tracer is to help track the source of that difference.

* chore: bump chromium in DEPS to 7c2b8cc3b8638aee8abeb013042a6c1d15b2da6b

* update patches

* impl SortingLSH service

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2425327

* 2446525: [Flash] Remove some Flash APIs

https://chromium-review.googlesource.com/c/chromium/src/+/2446525

* 2440974: Reland "Delete service_manager/embedder/switches.h"

https://chromium-review.googlesource.com/c/chromium/src/+/2440974

* 2359402: Remove ContentBrowserClient::NonNetworkURLLoaderFactoryDeprecatedMap.

https://chromium-review.googlesource.com/c/chromium/src/+/2359402

* 2250506: Implement tabs.removeCSS

https://chromium-review.googlesource.com/c/chromium/src/+/2250506

* 2429143: Remove implicit-conversion-to-integer ConvertRectToPixel() methods.

https://chromium-review.googlesource.com/c/chromium/src/+/2429143

* 2444430: Remove DataElementType::kBlob

https://chromium-review.googlesource.com/c/chromium/src/+/2444430

* 2441964: Clean up WebView public API

https://chromium-review.googlesource.com/c/chromium/src/+/2441964

* 2357523: Make ExtensionURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2357523

* 2461606: Use blink::mojom::PreferredColorScheme instead of blink::PreferredColorScheme

https://chromium-review.googlesource.com/c/chromium/src/+/2461606

* 2461235: a11y inspect reorg: move PropertyFilter struct to a new location

https://chromium-review.googlesource.com/c/chromium/src/+/2461235

* remove flash support

* fix frame_host_manager patch

* fix lint

* remove flash info from docs

* fix build

* fix osr

* chore: bump chromium in DEPS to 9269f9eb1d98d29564c2b2ab97f30c6e148c4e11

* fix visibilityState tests

* 2463049: Replace all uses of web_pref::AutoplayPolicy with mojom::AutoplayPolicy

https://chromium-review.googlesource.com/c/chromium/src/+/2463049

* update patches

* fix tests harder

* 2414921: Add Group and Ungroup functions to Tabs extension API

https://chromium-review.googlesource.com/c/chromium/src/+/2414921

* more test fix

* Remove all keyboard related usage of Xlib

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2436787

* fix linux build

* 2453807: [XProto] Remove usage of Xlib error handling

https://chromium-review.googlesource.com/c/chromium/src/+/2453807

* lint

* fixup! 2453807: [XProto] Remove usage of Xlib error handling

* disable CalculateNativeWinOcclusion on win ci

* remove UploadBlob from docs

* Update appveyor.yml

Co-authored-by: Andy Locascio <andy@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-10-15 18:30:41 -07:00

239 lines
7.8 KiB
Markdown

# Supported Command Line Switches
> Command line switches supported by Electron.
You can use [app.commandLine.appendSwitch][append-switch] to append them in
your app's main script before the [ready][ready] event of the [app][app] module
is emitted:
```javascript
const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
app.whenReady().then(() => {
// Your code here
})
```
## Electron CLI Flags
### --auth-server-whitelist=`url`
A comma-separated list of servers for which integrated authentication is enabled.
For example:
```sh
--auth-server-whitelist='*example.com, *foobar.com, *baz'
```
then any `url` ending with `example.com`, `foobar.com`, `baz` will be considered
for integrated authentication. Without `*` prefix the URL has to match exactly.
### --auth-negotiate-delegate-whitelist=`url`
A comma-separated list of servers for which delegation of user credentials is required.
Without `*` prefix the URL has to match exactly.
### --disable-ntlm-v2
Disables NTLM v2 for posix platforms, no effect elsewhere.
### --disable-http-cache
Disables the disk cache for HTTP requests.
### --disable-http2
Disable HTTP/2 and SPDY/3.1 protocols.
### --disable-renderer-backgrounding
Prevents Chromium from lowering the priority of invisible pages' renderer
processes.
This flag is global to all renderer processes, if you only want to disable
throttling in one window, you can take the hack of
[playing silent audio][play-silent-audio].
### --disk-cache-size=`size`
Forces the maximum disk space to be used by the disk cache, in bytes.
### --enable-api-filtering-logging
Enables caller stack logging for the following APIs (filtering events):
- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
- `remote.require()` / `remote-require`
- `remote.getGlobal()` / `remote-get-builtin`
- `remote.getBuiltin()` / `remote-get-global`
- `remote.getCurrentWindow()` / `remote-get-current-window`
- `remote.getCurrentWebContents()` / `remote-get-current-web-contents`
### --enable-logging
Prints Chromium's logging into console.
This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
environment variable to achieve the same effect.
### --host-rules=`rules`
A comma-separated list of `rules` that control how hostnames are mapped.
For example:
* `MAP * 127.0.0.1` Forces all hostnames to be mapped to 127.0.0.1
* `MAP *.google.com proxy` Forces all google.com subdomains to be resolved to
"proxy".
* `MAP test.com [::1]:77` Forces "test.com" to resolve to IPv6 loopback. Will
also force the port of the resulting socket address to be 77.
* `MAP * baz, EXCLUDE www.google.com` Remaps everything to "baz", except for
"www.google.com".
These mappings apply to the endpoint host in a net request (the TCP connect
and host resolver in a direct connection, and the `CONNECT` in an HTTP proxy
connection, and the endpoint host in a `SOCKS` proxy connection).
### --host-resolver-rules=`rules`
Like `--host-rules` but these `rules` only apply to the host resolver.
### --ignore-certificate-errors
Ignores certificate related errors.
### --ignore-connections-limit=`domains`
Ignore the connections limit for `domains` list separated by `,`.
### --js-flags=`flags`
Specifies the flags passed to the Node.js engine. It has to be passed when starting
Electron if you want to enable the `flags` in the main process.
```sh
$ electron --js-flags="--harmony_proxies --harmony_collections" your-app
```
See the [Node.js documentation][node-cli] or run `node --help` in your terminal for a list of available flags. Additionally, run `node --v8-options` to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.
### --lang
Set a custom locale.
### --log-net-log=`path`
Enables net log events to be saved and writes them to `path`.
### --no-proxy-server
Don't use a proxy server and always make direct connections. Overrides any other
proxy server flags that are passed.
### --no-sandbox
Disables Chromium sandbox, which is now enabled by default.
Should only be used for testing.
### --proxy-bypass-list=`hosts`
Instructs Electron to bypass the proxy server for the given semi-colon-separated
list of hosts. This flag has an effect only if used in tandem with
`--proxy-server`.
For example:
```javascript
const { app } = require('electron')
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
```
Will use the proxy server for all hosts except for local addresses (`localhost`,
`127.0.0.1` etc.), `google.com` subdomains, hosts that contain the suffix
`foo.com` and anything at `1.2.3.4:5678`.
### --proxy-pac-url=`url`
Uses the PAC script at the specified `url`.
### --proxy-server=`address:port`
Use a specified proxy server, which overrides the system setting. This switch
only affects requests with HTTP protocol, including HTTPS and WebSocket
requests. It is also noteworthy that not all proxy servers support HTTPS and
WebSocket requests. The proxy URL does not support username and password
authentication [per Chromium issue](https://bugs.chromium.org/p/chromium/issues/detail?id=615947).
### --remote-debugging-port=`port`
Enables remote debugging over HTTP on the specified `port`.
### --v=`log_level`
Gives the default maximal active V-logging level; 0 is the default. Normally
positive values are used for V-logging levels.
This switch only works when `--enable-logging` is also passed.
### --vmodule=`pattern`
Gives the per-module maximal V-logging levels to override the value given by
`--v`. E.g. `my_module=2,foo*=3` would change the logging level for all code in
source files `my_module.*` and `foo*.*`.
Any pattern containing a forward or backward slash will be tested against the
whole pathname and not only the module. E.g. `*/foo/bar/*=2` would change the
logging level for all code in the source files under a `foo/bar` directory.
This switch only works when `--enable-logging` is also passed.
### --force_high_performance_gpu
Force using discrete GPU when there are multiple GPUs available.
### --force_low_power_gpu
Force using integrated GPU when there are multiple GPUs available.
## Node.js Flags
Electron supports some of the [CLI flags][node-cli] supported by Node.js.
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
### --inspect-brk[=[host:]port]
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
Aliased to `--debug-brk=[host:]port`.
### --inspect-port=[host:]port
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
Aliased to `--debug-port=[host:]port`.
### --inspect[=[host:]port]
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).
See the [Debugging the Main Process][debugging-main-process] guide for more details.
Aliased to `--debug[=[host:]port`.
### --inspect-publish-uid=stderr,http
Specify ways of the inspector web socket url exposure.
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
[app]: app.md
[append-switch]: app.md#appcommandlineappendswitchswitch-value
[ready]: app.md#event-ready
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
[debugging-main-process]: ../tutorial/debugging-main-process.md
[node-cli]: https://nodejs.org/api/cli.html