-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Windows support for Unix shells and powershell (#860)
Excerpt from `:h shell-powershell`: To use powershell (on Windows): set shell=powershell shellquote=( shellpipe=\| shellxquote= set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command set shellredir=\|\ Out-File\ -Encoding\ UTF8
- Loading branch information
Showing
3 changed files
with
87 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Execute (plug#shellescape() works without optional arguments): | ||
if has('unix') | ||
AssertEqual "''", plug#shellescape("") | ||
AssertEqual "'foo'\\'''", plug#shellescape("foo'") | ||
endif | ||
|
||
Execute (plug#shellescape() ignores invalid optional argument): | ||
if has('unix') | ||
AssertEqual "''", plug#shellescape("", '') | ||
AssertEqual "'foo'\\'''", plug#shellescape("foo'", []) | ||
endif | ||
|
||
Execute (plug#shellescape() depends on the shell): | ||
AssertEqual "'foo'\\'''", plug#shellescape("foo'", {'shell': 'sh'}) | ||
AssertEqual '^"foo''^"', plug#shellescape("foo'", {'shell': 'cmd.exe'}) | ||
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell.exe'}) | ||
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'pwsh'}) | ||
|
||
Execute (plug#shellescape() supports non-trivial cmd.exe escaping): | ||
" batchfile | ||
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", { | ||
\ 'shell': 'cmd.exe', | ||
\ }) | ||
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", { | ||
\ 'shell': 'cmd.exe', | ||
\ 'script': 1, | ||
\ }) | ||
" command prompt | ||
AssertEqual '^"^^^%PATH^^^%^"', plug#shellescape("^%PATH^%", { | ||
\ 'shell': 'cmd.exe', | ||
\ 'script': 0, | ||
\ }), | ||
|
||
Execute (plug#shellescape() supports non-trivial powershell.exe escaping): | ||
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', { | ||
\ 'shell': 'powershell.exe', | ||
\ }), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters