Skip to content

Commit 3e6f341

Browse files
authored
fix(cli.rs): run powershell kill command without profile (#2130)
1 parent e663bdd commit 3e6f341

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
---
3+
"cli.rs": patch
4+
"cli.js": patch
5+
"tauri-bundler": patch
6+
---
7+
Run powershell commands with `-NoProfile` flag

tooling/bundler/src/bundle/windows/templates/main.wxs

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131

3232

3333
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
34-
34+
3535
<WixVariable Id="WixUIBannerBmp" Value="{{{icon_path}}}" />
3636
{{#if license}}
3737
<WixVariable Id="WixUILicenseRtf" Value="{{{license}}}" />
3838
{{/if}}
39-
39+
4040
<Icon Id="ProductIcon" SourceFile="{{{icon_path}}}"/>
4141
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
4242
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
@@ -111,7 +111,7 @@
111111

112112
<DirectoryRef Id="ApplicationProgramsFolder">
113113
<Component Id="ApplicationShortcut" Guid="81ccebd8-b769-4bed-bdbd-0340f9f7cad1">
114-
<Shortcut Id="ApplicationStartMenuShortcut"
114+
<Shortcut Id="ApplicationStartMenuShortcut"
115115
Name="{{{product_name}}}"
116116
Description="Runs {{{product_name}}}"
117117
Target="[!Path]"
@@ -193,14 +193,14 @@
193193
<Property Id="WVRTINSTALLED">
194194
<RegistrySearch Id="WVRTInstalled" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no"/>
195195
</Property>
196-
<CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -windowstyle hidden Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; &amp; $env:TEMP\MicrosoftEdgeWebview2Setup.exe /install' Return='check'/>
196+
<CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -NoProfile -windowstyle hidden Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; &amp; $env:TEMP\MicrosoftEdgeWebview2Setup.exe /install' Return='check'/>
197197
<InstallExecuteSequence>
198198
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
199199
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
200200
</Custom>
201201
</InstallExecuteSequence>
202202
{{/if}}
203203

204-
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
204+
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
205205
</Product>
206-
</Wix>
206+
</Wix>

tooling/cli.js/src/api/dependency-manager/rust.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function installRustup(): Promise<void> {
4141
await downloadRustup()
4242
}
4343
if (platform() === 'win32') {
44-
return spawnSync('powershell', [rustupPath], process.cwd())
44+
return spawnSync('powershell', ['-NoProfile', rustupPath], process.cwd())
4545
}
4646
return spawnSync('/bin/sh', [rustupPath], process.cwd())
4747
}

tooling/cli.rs/src/dev.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn kill_before_dev_process() {
3232
let mut child = child.lock().unwrap();
3333
#[cfg(windows)]
3434
let _ = Command::new("powershell")
35+
.arg("-NoProfile")
3536
.arg("-Command")
3637
.arg(format!("function Kill-Tree {{ Param([int]$ppid); Get-CimInstance Win32_Process | Where-Object {{ $_.ParentProcessId -eq $ppid }} | ForEach-Object {{ Kill-Tree $_.ProcessId }}; Stop-Process -Id $ppid }}; Kill-Tree {}", child.id()))
3738
.status();

0 commit comments

Comments
 (0)