Interested in helping open source friends on HP-UX?
[git/mjg.git] / test-run-command.c
blob89c7de2c600ce2781ce666324e703d555937740a
1 /*
2 * test-run-command.c: test run command API.
4 * (C) 2009 Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
6 * This code is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include "git-compat-util.h"
12 #include "run-command.h"
13 #include <string.h>
14 #include <errno.h>
16 int main(int argc, char **argv)
18 struct child_process proc = CHILD_PROCESS_INIT;
20 if (argc < 3)
21 return 1;
22 proc.argv = (const char **)argv+2;
24 if (!strcmp(argv[1], "start-command-ENOENT")) {
25 if (start_command(&proc) < 0 && errno == ENOENT)
26 return 0;
27 fprintf(stderr, "FAIL %s\n", argv[1]);
28 return 1;
30 if (!strcmp(argv[1], "run-command"))
31 exit(run_command(&proc));
33 fprintf(stderr, "check usage\n");
34 return 1;