Last active
November 13, 2015 04:27
-
-
Save akonwi/d81b558bf690a8408108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Public: Execute a git command. | |
# | |
# options - An {Object} with the following keys: | |
# :args - The {Array} containing the arguments to pass. | |
# :cwd - Current working directory as {String}. | |
# :options - The {Object} with options to pass. | |
# :stdout - The {Function} to pass the stdout to. | |
# :exit - The {Function} to pass the exit code to. | |
# | |
# Returns nothing. | |
gitCmd = ({args, cwd, options, stdout, stderr, exit}={}) -> | |
command = _getGitPath() | |
options ?= {} | |
options.cwd ?= cwd | |
stderr ?= (data) -> notifier.addError data.toString() | |
if stdout? and not exit? | |
c_stdout = stdout | |
stdout = (data) -> | |
@save ?= '' | |
@save += data | |
exit = (exit) -> | |
c_stdout @save ?= '' | |
@save = null | |
try | |
new BufferedProcess | |
command: command | |
args: args | |
options: options | |
stdout: stdout | |
stderr: stderr | |
exit: exit | |
catch error | |
notifier.addError 'Git Plus is unable to locate git command. Please ensure process.env.PATH can access git.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment