This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Use of spawnvp function makes console window appear.
- From: Kaz Kylheku <kaz at kylheku dot com>
- To: Cygwin <cygwin at cygwin dot com>
- Date: Wed, 29 Jun 2016 15:28:07 -0700
- Subject: Use of spawnvp function makes console window appear.
- Authentication-results: sourceware.org; auth=none
Hi all,
I've encountered a strange behavior. When a Cygwin C application that is
compiled with "-mwindows" tries to spawn another program, that
application
suddenly gets a console window!
Here is a simple, complete, repro case, that demonstrates the problem
under Cygwin 2.5.2, on Windows 7:
#include <windows.h>
#include <process.h>
int main(void)
{
const char * const argv[] = {
"c:/Windows/System32/notepad.exe",
0
};
Sleep(5000);
return spawnvp(_P_WAIT, argv[0], argv);
}
This is compiled as:
gcc -mwindows spawn.c -o spawn
If we launch this from the Windows Shell, then, correctly, it runs
with no console window. Nothing appears on the display for five
seconds, while it sits in the Sleep call.
Then, a console window opens with spawn.exe in its title,
immediately followed by the Notepad window over top.
What the heck?
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple