Httpie 在 Git Bash 终端挂起 Windows 10
Httpie hangs in Git Bash terminal on Windows 10
根据官方 documentation httpie 工具也适用于 Windows 10,但是当我 运行 终端中的命令它只是挂起并且没有任何反应:
$ http :8000/
是否有解释发生了什么,最好是解决方法?
我可以通过附加 --debug
参数得到提示:
$ http localhost:8000 --debug
HTTPie 0.9.9
Requests 2.12.4
Pygments 2.1.3
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
c:\users\...\venv\scripts\python.exe
Windows 10
<Environment {
"colors": 256,
"config": {
"__meta__": {
"about": "HTTPie configuration file",
"help": "https://httpie.org/docs#config",
"httpie": "0.9.9"
},
"default_options": "[]"
},
"config_dir": "C:\Users\...\AppData\Roaming\\httpie",
"is_windows": true,
"stderr": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDAB00>",
"stderr_isatty": false,
"stdin": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp1252'>",
"stdin_encoding": "cp1252",
"stdin_isatty": false,
"stdout": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDA9B0>",
"stdout_encoding": "cp1252",
"stdout_isatty": false
}>
关键是isatty
相关选项设置为false
.
我能够解决它并通过在 winpty
命令前面添加 http
按预期工作:
$ winpty http :8000
HTTP/1.0 200 OK
Content-Type: application/json
Date: Fri, 16 Dec 2016 19:56:58 GMT
Server: WSGIServer/0.2 CPython/3.4.4
X-Frame-Options: SAMEORIGIN
{
"status": "ok"
}
解法:
通过添加此别名行
alias http='winpty http'
到 ~/.profile
文件,可以像预期的那样使用初始命令 http
和 git bash
。
根据官方 documentation httpie 工具也适用于 Windows 10,但是当我 运行 终端中的命令它只是挂起并且没有任何反应:
$ http :8000/
是否有解释发生了什么,最好是解决方法?
我可以通过附加 --debug
参数得到提示:
$ http localhost:8000 --debug
HTTPie 0.9.9
Requests 2.12.4
Pygments 2.1.3
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
c:\users\...\venv\scripts\python.exe
Windows 10
<Environment {
"colors": 256,
"config": {
"__meta__": {
"about": "HTTPie configuration file",
"help": "https://httpie.org/docs#config",
"httpie": "0.9.9"
},
"default_options": "[]"
},
"config_dir": "C:\Users\...\AppData\Roaming\\httpie",
"is_windows": true,
"stderr": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDAB00>",
"stderr_isatty": false,
"stdin": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp1252'>",
"stdin_encoding": "cp1252",
"stdin_isatty": false,
"stdout": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDA9B0>",
"stdout_encoding": "cp1252",
"stdout_isatty": false
}>
关键是isatty
相关选项设置为false
.
我能够解决它并通过在 winpty
命令前面添加 http
按预期工作:
$ winpty http :8000
HTTP/1.0 200 OK
Content-Type: application/json
Date: Fri, 16 Dec 2016 19:56:58 GMT
Server: WSGIServer/0.2 CPython/3.4.4
X-Frame-Options: SAMEORIGIN
{
"status": "ok"
}
解法:
通过添加此别名行
alias http='winpty http'
到 ~/.profile
文件,可以像预期的那样使用初始命令 http
和 git bash
。