Pike v8.1 release 6

Method Git.try_git()


Method try_git

string try_git(string git_dir, string command, string ... args)

Description

Attempt to run a git command and get its output.

Parameter git_dir

Directory containing the Git repository. May be UNDEFINED to specify the Git repository for the current directory.

Parameter command

Git subcommand to execute.

Parameter args

Arguemnts for command.

Returns

Returns the output on stdout from running the command on success, and 0 (zero) on failure.

Note

This is a convenience function, and there is no way to get the specific cause for failures other than rerunning the command with e.g. git().

See also

git(), low_git()