1 /* cygrun.c: testsuite support program
3 Copyright 1999, 2000, 2001 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 /* This program is intended to be used only by the testsuite. It runs
12 programs without using the cygwin api, so that the just-built dll
13 can be tested without interference from the currently installed
21 main(int argc, char **argv)
24 PROCESS_INFORMATION pi;
29 fprintf(stderr, "Usage: cygrun [program]\n");
33 putenv("CYGWIN_TESTING=1");
34 SetEnvironmentVariable("CYGWIN_TESTING", "1");
36 memset(&sa, 0, sizeof(sa));
37 memset(&pi, 0, sizeof(pi));
38 if (!CreateProcess(0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi))
40 fprintf(stderr, "CreateProcess %s failed\n", argv[1]);
44 WaitForSingleObject(pi.hProcess, INFINITE);
46 GetExitCodeProcess(pi.hProcess, &ec);
48 CloseHandle(pi.hProcess);
49 CloseHandle(pi.hThread);