mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
fix(pwsh): do not check for write permissions
as this permission is already present, it does not set executable permissions when needed rsulting is a crashing command resolves #393
This commit is contained in:
parent
b830ae662a
commit
9db255e06f
|
@ -32,17 +32,15 @@ function Set-ExecutablePermissions {
|
|||
$permissions = ((ls -l $executable) -split ' ')[0] # $permissions will be something like '-rw-r--r--'
|
||||
if ((id -u) -eq 0) {
|
||||
# Running as root, give global executable permissions if needed
|
||||
$hasWrite = $permissions[2] -eq 'w'
|
||||
$hasExecutable = $permissions[3] -eq 'x'
|
||||
if ($hasWrite -and -not $hasExecutable) {
|
||||
if (-not $hasExecutable) {
|
||||
Invoke-Expression -Command "chmod g+x $executable"
|
||||
}
|
||||
return
|
||||
}
|
||||
# Running as user, give user executable permissions if needed
|
||||
$hasWrite = $permissions[8] -eq 'w'
|
||||
$hasExecutable = $permissions[9] -eq 'x'
|
||||
if ($hasWrite -and -not $hasExecutable) {
|
||||
if (-not $hasExecutable) {
|
||||
Invoke-Expression -Command "chmod +x $executable"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue