Skip to content

Commit 7c0fa1f

Browse files
authored
fix(bundler): clear env before calling wix, closes #4791 (#4819)
1 parent a6c9411 commit 7c0fa1f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.changes/wix-clear-env.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Clear environment variables on the WiX light.exe and candle.exe commands to avoid "Windows Installer Service could not be accessed" error. Variables prefixed with `TAURI` are propagated.

.github/workflows/artifacts-updater.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
working-directory: ./examples/updater
115115
run: |
116116
yarn install
117-
cargo tauri build
117+
cargo tauri build --verbose
118118
env:
119119
# Notarization (disabled)
120120
# FIXME: enable only on `dev` push maybe? as it take some times...
@@ -134,7 +134,7 @@ jobs:
134134
working-directory: ./examples/updater
135135
run: |
136136
yarn install
137-
cargo tauri build
137+
cargo tauri build --verbose
138138
env:
139139
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
140140
# upload assets

tooling/bundler/src/bundle/windows/msi/wix.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ pub fn get_and_extract_wix(path: &Path) -> crate::Result<()> {
281281
extract_zip(&data, path)
282282
}
283283

284+
fn clear_env_for_wix(cmd: &mut Command) {
285+
cmd.env_clear();
286+
for (k, v) in std::env::vars_os() {
287+
if ["SYSTEMROOT", "TMP", "TEMP"].contains(k) || k.to_string_lossy().starts_with("TAURI") {
288+
cmd.env(k, v);
289+
}
290+
}
291+
}
292+
284293
/// Runs the Candle.exe executable for Wix. Candle parses the wxs file and generates the code for building the installer.
285294
fn run_candle(
286295
settings: &Settings,
@@ -334,6 +343,7 @@ fn run_candle(
334343
cmd.arg("-ext");
335344
cmd.arg(ext);
336345
}
346+
clear_env_for_wix(&mut cmd);
337347
cmd
338348
.args(&args)
339349
.current_dir(cwd)
@@ -369,6 +379,7 @@ fn run_light(
369379
cmd.arg("-ext");
370380
cmd.arg(ext);
371381
}
382+
clear_env_for_wix(&mut cmd);
372383
cmd
373384
.args(&args)
374385
.current_dir(build_path)

0 commit comments

Comments
 (0)