mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-09-27 07:46:27 +00:00
Use fixed path to cmd.exe (#1921)
* Use fixed path to cmd.exe * Use $env:COMSPEC instead of $env:WINDIR
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ function git_proxy_cmd {
|
||||
if($proxy) {
|
||||
$cmd = "SET HTTPS_PROXY=$proxy&&SET HTTP_PROXY=$proxy&&$cmd"
|
||||
}
|
||||
cmd /c $cmd
|
||||
& "$env:COMSPEC" /c $cmd
|
||||
}
|
||||
|
||||
function git_clone {
|
||||
|
||||
+6
-6
@@ -364,7 +364,7 @@ function dl_urls($app, $version, $manifest, $architecture, $dir, $use_cache = $t
|
||||
try {
|
||||
rm -r -force "$dir\_tmp" -ea stop
|
||||
} catch [system.io.pathtoolongexception] {
|
||||
cmd /c "rmdir /s /q $dir\_tmp"
|
||||
& "$env:COMSPEC" /c "rmdir /s /q $dir\_tmp"
|
||||
} catch [system.unauthorizedaccessexception] {
|
||||
warn "Couldn't remove $dir\_tmp: unauthorized access."
|
||||
}
|
||||
@@ -744,10 +744,10 @@ function link_current($versiondir) {
|
||||
if(test-path $currentdir) {
|
||||
# remove the junction
|
||||
attrib -R /L $currentdir
|
||||
cmd /c rmdir $currentdir
|
||||
& "$env:COMSPEC" /c rmdir $currentdir
|
||||
}
|
||||
|
||||
cmd /c mklink /j $currentdir $versiondir | out-null
|
||||
& "$env:COMSPEC" /c mklink /j $currentdir $versiondir | out-null
|
||||
attrib $currentdir +R /L
|
||||
return $currentdir
|
||||
}
|
||||
@@ -768,7 +768,7 @@ function unlink_current($versiondir) {
|
||||
attrib $currentdir -R /L
|
||||
|
||||
# remove the junction
|
||||
cmd /c rmdir $currentdir
|
||||
& "$env:COMSPEC" /c "rmdir $currentdir"
|
||||
return $currentdir
|
||||
}
|
||||
return $versiondir
|
||||
@@ -1018,10 +1018,10 @@ function persist_data($manifest, $original_dir, $persist_dir) {
|
||||
|
||||
# create link
|
||||
if (is_directory $target) {
|
||||
cmd /c "mklink /j `"$source`" `"$target`"" | out-null
|
||||
& "$env:COMSPEC" /c "mklink /j `"$source`" `"$target`"" | out-null
|
||||
attrib $source.FullName +R /L
|
||||
} else {
|
||||
cmd /c "mklink /h `"$source`" `"$target`"" | out-null
|
||||
& "$env:COMSPEC" /c "mklink /h `"$source`" `"$target`"" | out-null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -24,10 +24,10 @@ function install_psmodule($manifest, $dir, $global) {
|
||||
|
||||
if(test-path $linkfrom) {
|
||||
warn "$(friendly_path $linkfrom) already exists. It will be replaced."
|
||||
cmd /c rmdir $linkfrom
|
||||
& "$env:COMSPEC" /c "rmdir $linkfrom"
|
||||
}
|
||||
|
||||
cmd /c mklink /j $linkfrom $dir | out-null
|
||||
& "$env:COMSPEC" /c "mklink /j $linkfrom $dir" | out-null
|
||||
}
|
||||
|
||||
function uninstall_psmodule($manifest, $dir, $global) {
|
||||
@@ -41,7 +41,7 @@ function uninstall_psmodule($manifest, $dir, $global) {
|
||||
if(test-path $linkfrom) {
|
||||
write-host "Removing $(friendly_path $linkfrom)"
|
||||
$linkfrom = resolve-path $linkfrom
|
||||
cmd /c rmdir $linkfrom
|
||||
& "$env:COMSPEC" /c "rmdir $linkfrom"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user