Skip to content

Commit 6fea207

Browse files
py0nmattn
authored andcommitted
* sh (bash, ksh, zsh) is in use, stderr is redirected to /dev/tty.
1 parent 6253ecd commit 6fea207

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

autoload/http.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ function! http#get(url, ...)
124124
if strlen(getdatastr)
125125
let url .= "?" . getdatastr
126126
endif
127+
let old_shellredir = &shellredir
128+
if &shell =~ "\\(ba\\|k\\|z\\)\\?sh"
129+
set shellredir =>%s\ 2>/dev/tty
130+
endif
127131
if executable('curl')
128132
let command = 'curl -L -s -k -i '
129133
let quote = &shellxquote == '"' ? "'" : '"'
@@ -149,6 +153,7 @@ function! http#get(url, ...)
149153
let command .= " ".quote.url.quote
150154
let res = system(command)
151155
endif
156+
let &shellredir = old_shellredir
152157
if res =~ '^HTTP/1.\d 3' || res =~ '^HTTP/1\.\d 200 Connection established'
153158
let pos = stridx(res, "\r\n\r\n")
154159
if pos != -1
@@ -181,6 +186,10 @@ function! http#post(url, ...)
181186
else
182187
let postdatastr = postdata
183188
endif
189+
let old_shellredir = &shellredir
190+
if &shell =~ "\\(ba\\|k\\|z\\)\\?sh"
191+
set shellredir =>%s\ 2>/dev/tty
192+
endif
184193
if executable('curl')
185194
let command = 'curl -L -s -k -i -X '.method
186195
let quote = &shellxquote == '"' ? "'" : '"'
@@ -211,6 +220,7 @@ function! http#post(url, ...)
211220
call writefile(split(postdatastr, "\n"), file, "b")
212221
let res = system(command . " --post-data @" . quote.file.quote)
213222
endif
223+
let &shellredir = old_shellredir
214224
call delete(file)
215225
if res =~ '^HTTP/1.\d 3' || res =~ '^HTTP/1\.\d 200 Connection established'
216226
let pos = stridx(res, "\r\n\r\n")

0 commit comments

Comments
 (0)