locked
External tool not receiving ctrl+c interrupts RRS feed

  • Question

  • 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?

    Thanks,

    -Mike

    Monday, March 12, 2012 2:30 PM

Answers

  • You could create a package / AddIn / macro that spawned the process.

    Ryan

    • Marked as answer by Mike Healey Wednesday, March 14, 2012 10:18 AM
    Tuesday, March 13, 2012 2:09 PM

All replies

  • 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.

    Ryan

    Monday, March 12, 2012 9:00 PM
  • Hi Ryan,

    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.

    thanks

    -Mike

    Tuesday, March 13, 2012 9:32 AM
  • You could create a package / AddIn / macro that spawned the process.

    Ryan

    • Marked as answer by Mike Healey Wednesday, March 14, 2012 10:18 AM
    Tuesday, March 13, 2012 2:09 PM