Fix null device when running sh.exe through cmd.exe
Use "nul" as null device since output is redirected by cmd.exe.
diff --git a/src/Charmonizer/Core/OperatingSystem.c b/src/Charmonizer/Core/OperatingSystem.c
index 6fc7484..446872b 100644
--- a/src/Charmonizer/Core/OperatingSystem.c
+++ b/src/Charmonizer/Core/OperatingSystem.c
@@ -83,6 +83,9 @@
chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
chaz_OS.run_sh_via_cmd_exe = 0;
}
+
+ /* Redirection is always run through cmd.exe. */
+ strcpy(chaz_OS.dev_null, "nul");
}
else if (output_len >= 7 && memcmp(output, "foo^bar", 7) == 0) {
/* Escape character is backslash. */
@@ -90,17 +93,16 @@
printf("Detected POSIX shell\n");
}
chaz_OS.shell_type = CHAZ_OS_POSIX;
+ strcpy(chaz_OS.dev_null, "/dev/null");
}
if (chaz_OS.shell_type == CHAZ_OS_CMD_EXE) {
strcpy(chaz_OS.dir_sep, "\\");
- strcpy(chaz_OS.dev_null, "nul");
/* Empty string should work, too. */
strcpy(chaz_OS.local_command_start, ".\\");
}
else if (chaz_OS.shell_type == CHAZ_OS_POSIX) {
strcpy(chaz_OS.dir_sep, "/");
- strcpy(chaz_OS.dev_null, "/dev/null");
strcpy(chaz_OS.local_command_start, "./");
}
else {