blob: c718d994892e9ec71302828b5e9226e2c9f7695b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "libbb.h"
int mingw_system(const char *cmd)
{
const char *argv[4] = { "sh", "-c", cmd, NULL };
intptr_t proc;
HANDLE h;
DWORD ret = 0;
if (cmd == NULL)
return 1;
if ((proc=mingw_spawn_proc(argv)) == -1)
return -1;
h = (HANDLE)proc;
WaitForSingleObject(h, INFINITE);
GetExitCodeProcess(h, &ret);
CloseHandle(h);
return exit_code_to_wait_status(ret);
}
|