13

In Bash

$ git status > /dev/null; echo $?
0

Same repository in 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?

2

1 Answer 1

17

When you specify the arguments to git incorrectly (and needs to print its usage) it will exit with error code 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?)

You could avoid passing arguments entirely by calling the git-status command instead of calling git with the status argument.

Sign up to request clarification or add additional context in comments.

3 Comments

there is a problem with calling git-status: "Start-Process : This command cannot be run due to the error: The system cannot find the file specified."
@ДМИТРИЙМАЛИКОВ Well, you may need to specify the full path, or put the git libexec directory in your %PATH%.
Same thing when calling [git add --pathspec-from-file=file.txt] on git 2.19.1.4 which does not support this option.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.