[PATCH c-hglib] hg_exitcode: the exitcode for the current command

Iulian Stana julian.stana at gmail.com
Wed Sep 18 18:25:27 CDT 2013


# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379454205 -10800
#      Wed Sep 18 00:43:25 2013 +0300
# Node ID 416d889424e9d56532608a3ab803bdd2e5a633b4
# Parent  8bdb422f21775a3826a59eeefd17e3f6da6a0308
hg_exitcode: the exitcode for the current command

The server tell use that he finished his action when the 'r' channel is send.
This function will get the exitcode from the server.

diff --git a/hglib/client.c b/hglib/client.c
--- a/hglib/client.c
+++ b/hglib/client.c
@@ -295,3 +295,23 @@
 	return length;
 }
 
+/*
+ * The exitcode for the current command.
+ * */
+int hg_exitcode(hg_handle *handle)
+{
+	int exitcode;
+
+	if (handle == NULL) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (read(handle->p_read, &exitcode, sizeof(int)) < 0) {
+		return -1;
+	}
+	handle->protect = 0;
+	return swap_uint32(exitcode);
+}
+
+


More information about the Mercurial-devel mailing list