Change _MSC_VER to PLATFORM_WINDOWS for some exec. Fix to nix.

This commit is contained in:
Christoffer Lerno
2025-01-22 00:34:36 +01:00
parent 3221180315
commit a845a932f5
4 changed files with 6 additions and 5 deletions

View File

@@ -58,7 +58,7 @@ in llvmPackages.stdenv.mkDerivation (finalAttrs: {
checkPhase = ''
runHook preCheck
( cd ../resources/testproject; ../../build/c3c build )
( cd ../resources/testproject; ../../build/c3c build --trust=full )
( cd ../test; python src/tester.py ../build/c3c test_suite )
runHook postCheck
'';

View File

@@ -19,7 +19,7 @@
- Fix `linux-crt` and `linux-crtbegin` not getting recognized as a project paramater
- Fix dues to crash when converting a const vector to another vector #1864.
- Filter `$exec` output from `\r`, which otherwise would cause a compiler assert #1867.
- Fixes to `"exec" use.
- Fixes to `"exec" use, including issue when compiling with MinGW
### Stdlib changes
- Added '%h' and '%H' for printing out binary data in hexadecimal using the formatter.

View File

@@ -1554,7 +1554,7 @@ File *compile_and_invoke(const char *file, const char *args, const char *stdin_d
}
DEBUG_LOG("EXEC OUT: %s", out);
scratch_buffer_clear();
#if (!_MSC_VER)
#if (!PLATFORM_WINDOWS)
scratch_buffer_append("./");
#endif
scratch_buffer_append(output);

View File

@@ -718,6 +718,7 @@ char *execute_cmd(const char *cmd, bool ignore_failure, const char *stdin_string
bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_string)
{
DEBUG_LOG("Executing: %s", cmd);
char buffer[BUFSIZE];
char *output = "";
FILE *process = NULL;
@@ -726,7 +727,7 @@ bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_stri
{
cmd = strdup(cmd);
scratch_buffer_clear();
#if (_MSC_VER)
#if (PLATFORM_WINDOWS)
scratch_buffer_printf("%s < __c3temp.bin", cmd);
#else
scratch_buffer_printf("cat __c3temp.bin | %s", cmd);
@@ -737,7 +738,7 @@ bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_stri
fputs(stdin_string, f);
fclose(f);
}
#if (_MSC_VER)
#if (PLATFORM_WINDOWS)
if (!(process = _wpopen(win_utf8to16(cmd), L"rb"))) return false;
#else
if (!(process = popen(cmd, "r"))) return false;