Skip to content

fix qjsc for Windows #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion qjsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,13 @@ void help(void)
exit(1);
}

#if defined(CONFIG_CC) && !defined(_WIN32)
#if defined(CONFIG_CC)

int exec_cmd(char **argv)
{
#ifdef _WIN32
return _spawnvp(_P_WAIT, argv[0], (const char * const *)argv);
#else
int pid, status, ret;

pid = fork();
Expand All @@ -392,6 +395,7 @@ int exec_cmd(char **argv)
break;
}
return WEXITSTATUS(status);
#endif
}

static int output_executable(const char *out_filename, const char *cfilename,
Expand Down Expand Up @@ -679,7 +683,11 @@ int main(int argc, char **argv)

if (!out_filename) {
if (output_type == OUTPUT_EXECUTABLE) {
#ifdef _WIN32
out_filename = "a.exe";
#else
out_filename = "a.out";
#endif
} else {
out_filename = "out.c";
}
Expand Down