private void HandleCommandComplete(int exitCode, string output, string error, CommandCompleteHandler continuation, CommandCompleteHandler externalCallback) { try { bool success = exitCode == 0; string message = success ? output : error; continuation(success, message); externalCallback?.Invoke(success, message); } catch (Exception e) { // marshal exceptions back to main thread for Unity to handle them _threadMarshaller.Marshal(() => Throw(e)); } }
private void RunCommand(string command, CommandCompleteHandler continuation, CommandCompleteHandler externalCallback = null) { Debug.Log("Running git " + command); _commandRunner.Run(command, (code, o, e) => HandleCommandComplete(code, o, e, continuation, externalCallback)); }
public void Update(CommandCompleteHandler handler = null) { RunCommand("lfs locks --json", HandleLocksCommandComplete, handler); }