Merge branch 'ef/maint-rebase-error-message'
[gitweb.git] / run-command.c
index 9c5a564ece033e8584be14c640f6a9995ecd1cff..606791dc674a1d24459d85504f0c981634b52020 100644 (file)
@@ -4,6 +4,10 @@
 #include "sigchain.h"
 #include "argv-array.h"
 
+#ifndef SHELL_PATH
+# define SHELL_PATH "/bin/sh"
+#endif
+
 struct child_to_clean {
        pid_t pid;
        struct child_to_clean *next;
@@ -152,7 +156,11 @@ static const char **prepare_shell_cmd(const char **argv)
                die("BUG: shell command is empty");
 
        if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
+#ifndef WIN32
+               nargv[nargc++] = SHELL_PATH;
+#else
                nargv[nargc++] = "sh";
+#endif
                nargv[nargc++] = "-c";
 
                if (argc < 2)