=Fixed linux bug with latest edit-textfile change
This commit is contained in:
parent
d33131cd78
commit
a8f55a151d
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue