=Fixed linux bug with latest edit-textfile change

This commit is contained in:
lksz 2021-06-29 23:16:28 -04:00
parent d33131cd78
commit a8f55a151d
1 changed files with 5 additions and 5 deletions

View File

@ -18,16 +18,16 @@ end {
$local:editor = $null $local:editor = $null
foreach( $local:testEditor in $editors ) { foreach( $local:testEditor in $editors ) {
if( $(try{Get-Command -ListImported -Type Application $testEditor -ErrorAction SilentlyContinue}catch{}) ) { if( $(try{Get-Command -ListImported -Type Application $testEditor -ErrorAction SilentlyContinue}catch{}) ) {
$editor = $testEditor $editor = "`"$testEditor`""
break; break;
} }
} }
if( $editor -match 'vim?$' ) { if( $editor -match 'vim?"$' ) {
$editor += ' -p' $editor += ' -p'
} }
if( $editor -match 'code(\.exe)?$' ) { if( $editor -match 'code(\.exe)?"$' ) {
if( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) { if( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) {
Invoke-ExpressionEx -sudo:$sudo $editor Invoke-ExpressionEx -sudo:$sudo $editor
} }
@ -39,6 +39,6 @@ end {
if( $Path ) { $arguments = "$arguments" } if( $Path ) { $arguments = "$arguments" }
if( $PSCmdlet.ShouldProcess( "Edit ($editor): $arguments" ) ) { if( $PSCmdlet.ShouldProcess( "Edit ($editor): $arguments" ) ) {
Invoke-ExpressionEx -sudo:$sudo "& `"$editor`"" "$arguments" Invoke-ExpressionEx -sudo:$sudo "& $editor $arguments"
} }
} }