summaryrefslogtreecommitdiff
path: root/test-run-command.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-20 14:44:12 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-20 14:44:12 -0800
commit030b1a77f72a7e3307c7d7881ae570ca1c8ed877 (patch)
tree1c25e1ee45851d02c59bb5e420fd39f4c51520f6 /test-run-command.c
parent3af59e6f31c5304d476884b69b6b88dfd492812b (diff)
parent6b02de3b9dc4ac8374cea4964e993ec6636d781c (diff)
downloadgit-030b1a77f72a7e3307c7d7881ae570ca1c8ed877.tar.gz
Merge branch 'js/exec-error-report'
* js/exec-error-report: Improve error message when a transport helper was not found start_command: detect execvp failures early run-command: move wait_or_whine earlier start_command: report child process setup errors to the parent's stderr Conflicts: Makefile
Diffstat (limited to 'test-run-command.c')
-rw-r--r--test-run-command.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/test-run-command.c b/test-run-command.c
new file mode 100644
index 0000000000..0612bfa7cd
--- /dev/null
+++ b/test-run-command.c
@@ -0,0 +1,35 @@
+/*
+ * test-run-command.c: test run command API.
+ *
+ * (C) 2009 Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
+ *
+ * This code is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "git-compat-util.h"
+#include "run-command.h"
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char **argv)
+{
+ struct child_process proc;
+
+ memset(&proc, 0, sizeof(proc));
+
+ if (argc < 3)
+ return 1;
+ proc.argv = (const char **)argv+2;
+
+ if (!strcmp(argv[1], "start-command-ENOENT")) {
+ if (start_command(&proc) < 0 && errno == ENOENT)
+ return 0;
+ fprintf(stderr, "FAIL %s\n", argv[1]);
+ return 1;
+ }
+
+ fprintf(stderr, "check usage\n");
+ return 1;
+}