fix(cli.rs): run powershell kill command without profile (#2130)

This commit is contained in:
Amr Bashir
2021-06-30 20:12:37 +02:00
committed by GitHub
parent e663bdd593
commit 3e6f34160d
4 changed files with 15 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
---
"cli.rs": patch
"cli.js": patch
"tauri-bundler": patch
---
Run powershell commands with `-NoProfile` flag

View File

@@ -31,12 +31,12 @@
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
<WixVariable Id="WixUIBannerBmp" Value="{{{icon_path}}}" />
{{#if license}}
<WixVariable Id="WixUILicenseRtf" Value="{{{license}}}" />
{{/if}}
<Icon Id="ProductIcon" SourceFile="{{{icon_path}}}"/>
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
@@ -111,7 +111,7 @@
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="81ccebd8-b769-4bed-bdbd-0340f9f7cad1">
<Shortcut Id="ApplicationStartMenuShortcut"
<Shortcut Id="ApplicationStartMenuShortcut"
Name="{{{product_name}}}"
Description="Runs {{{product_name}}}"
Target="[!Path]"
@@ -193,7 +193,7 @@
<Property Id="WVRTINSTALLED">
<RegistrySearch Id="WVRTInstalled" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no"/>
</Property>
<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'/>
<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'/>
<InstallExecuteSequence>
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
@@ -201,6 +201,6 @@
</InstallExecuteSequence>
{{/if}}
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
</Product>
</Wix>
</Wix>

View File

@@ -41,7 +41,7 @@ async function installRustup(): Promise<void> {
await downloadRustup()
}
if (platform() === 'win32') {
return spawnSync('powershell', [rustupPath], process.cwd())
return spawnSync('powershell', ['-NoProfile', rustupPath], process.cwd())
}
return spawnSync('/bin/sh', [rustupPath], process.cwd())
}

View File

@@ -32,6 +32,7 @@ fn kill_before_dev_process() {
let mut child = child.lock().unwrap();
#[cfg(windows)]
let _ = Command::new("powershell")
.arg("-NoProfile")
.arg("-Command")
.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()))
.status();