diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:31 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:31 +0000 |
commit | 369d8a8fd5e887eca547bf34bccfdf755c9e5397 (patch) | |
tree | 5c5dc851bf01a5938662571357ffd5d7bb152a79 /winsup/cygwin/cygrun.c | |
parent | 4415a7ef3e26c669f5f7c5c7efbf7b6ea9b7e2f4 (diff) | |
download | cygnal-369d8a8fd5e887eca547bf34bccfdf755c9e5397.tar.gz cygnal-369d8a8fd5e887eca547bf34bccfdf755c9e5397.tar.bz2 cygnal-369d8a8fd5e887eca547bf34bccfdf755c9e5397.zip |
import winsup-2000-02-17 snapshot
Diffstat (limited to 'winsup/cygwin/cygrun.c')
-rw-r--r-- | winsup/cygwin/cygrun.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/winsup/cygwin/cygrun.c b/winsup/cygwin/cygrun.c new file mode 100644 index 000000000..8aa3e30a1 --- /dev/null +++ b/winsup/cygwin/cygrun.c @@ -0,0 +1,50 @@ +/* cygrun.c: testsuite support program + + Copyright 1999 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* This program is intended to be used only by the testsuite. It runs + programs without using the cygwin api, so that the just-built dll + can be tested without interference from the currently installed + dll. */ + +#include <stdio.h> +#include <windows.h> + +int +main(int argc, char **argv) +{ + STARTUPINFO sa; + PROCESS_INFORMATION pi; + DWORD ec = 1; + + if (argc < 2) + { + fprintf(stderr, "Usage: cygrun [program]\n"); + exit (0); + } + + setenv("CYGWIN_TESTING", "1"); + SetEnvironmentVariable("CYGWIN_TESTING", "1"); + + memset(&sa, 0, sizeof(sa)); + memset(&pi, 0, sizeof(pi)); + if (!CreateProcess(0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi)) + { + fprintf(stderr, "CreateProcess %s failed\n", argv[1]); + exit(1); + } + + WaitForSingleObject(pi.hProcess, INFINITE); + + GetExitCodeProcess(pi.hProcess, &ec); + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return ec; +} |