bash 启动进程“git”返回奇怪的 129 退出代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21733440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Start-Process "git" returns strange 129 exit code
提问by ДМИТРИЙ МАЛИКОВ
In Bash
在 Bash 中
$ git status > /dev/null; echo $?
0
Same repository in Powershell
Powershell 中的相同存储库
$> (Start-Process git -ArgumentList="status" -Wait -PassThru).ExitCode
129
What is going on here, what 129
means and why it is not equal to 0
and how to get it right?
这里发生了什么,什么129
意思,为什么不等于0
以及如何正确处理?
回答by Edward Thomson
When you specify the arguments to git
incorrectly (and needs to print its usage) it will exit with error code 129:
当您git
错误地指定参数(并需要打印其用法)时,它将退出并显示错误代码 129:
C:\Temp>git status --asdf
error: unknown option `asdf`
usage: git status [options] [--] <filepattern>...
.... help is printed here ....
C:\Temp>echo %ERRORLEVEL%
129
Is it possible that you are passing the commands through PowerShell incorrectly? (Eg, is -Wait -Passthrough
being delivered to git-status
?)
您是否有可能错误地通过 PowerShell 传递命令?(例如,-Wait -Passthrough
正在交付给git-status
?)
You could avoid passing arguments entirely by calling the git-status
command instead of calling git
with the status
argument.
你可以完全避免通过调用传递参数git-status
的命令,而不是调用git
与status
参数。