Skip to main content

guard_process_start

Function guard_process_start 

Source
pub fn guard_process_start() -> Result<GuardReport, DevToolsError>
Expand description

Process-start guard. Call it first in main (before Tauri builds anything) to fail before any webview exists; the shell plugin also runs it when it is constructed and refuses to set up when it failed. Idempotent: the first result is returned on every call.

  1. Refuses a launch argument that enables remote debugging or auto-opens DevTools.
  2. Removes the WebView2 override environment variables from this process, so they cannot reach the browser process that WebView2 starts later (Windows).
  3. Refuses to continue when the WebView2 AdditionalBrowserArguments policy (HKLM, HKCU, WOW6432Node) injects a debugging switch. WebView2 appends policy arguments to whatever the application passes, so the application cannot override them (Windows).
  4. Refuses to continue when the WebView2 BrowserExecutableFolder policy, or the environment variable of the same purpose, makes WebView2 start a browser from another folder for this program (Windows).
  5. Records the folders the UserDataFolder policy and the WebView2 user-data environment variable name, so the port-file tripwire looks there too (Windows).

A build compiled with the dev-inspect feature does none of this: it prints one loud stderr line saying developer inspection is active and returns an empty report.