blob: 02aaaa0a12b3aa090d4d8be64a4fdd73e29ebb94 (
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((char **)argv)) == -1)
return -1;
h = (HANDLE)proc;
WaitForSingleObject(h, INFINITE);
GetExitCodeProcess(h, &ret);
CloseHandle(h);
return ret << 8;
}
|