יום שני 12 מרץ 2012 14:30
I'm trying to execute a batch file from the External Tools menu of VS2010 (Professional edition, Windows 7 x64). The batch file launches a program (Android NDK GDB) which intercepts the SIGINT signal generated by hitting CTRL+C to pause execution. This batch file works fine when run from a normal command prompt, but when running an External Tool set to "cmd.exe" with argument "/C mybatchfile.bat" CTRL+C does nothing.
I'm guessing that something about the way VS is spawning cmd.exe causes the CTRL+C to be intercepted by something before it gets to the program I want to handle it. Any ideas if this behaviour can be changed, or am I stuck with having to manually switch to command prompt window?
יום שני 12 מרץ 2012 21:00מנחה דיון
It looks like VS passing CREATE_NEW_PROCESS_GROUP to CreateProcess when it spawns of the process for the external tool. MSDN has this to say about that (emphasis mine):
The new process is the root process of a new process group. The process group includes all processes that are descendants of this root process. The process identifier of the new process group is the same as the process identifier, which is returned in the lpProcessInformation parameter. Process groups are used by the GenerateConsoleCtrlEvent function to enable sending a CTRL+BREAK signal to a group of console processes.
If this flag is specified, CTRL+C signals will be disabled for all processes within the new process group.
יום שלישי 13 מרץ 2012 09:32
that does sound like it would explain what's happening. Unfortunately I can't see any way around it without creating an executable to spawn the process with different flags.
יום שלישי 13 מרץ 2012 14:09מנחה דיון
You could create a package / AddIn / macro that spawned the process.
- סומן כתשובה על-ידי Mike Healey יום רביעי 14 מרץ 2012 10:18