This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Use of spawnvp function makes console window appear.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]