Hi, On Mon, Nov 9, 2015 at 1:04 PM, James Yonan <ja...@openvpn.net> wrote: >>> I plan to add a control-C handler in win32.c. The handler will simply >>> map it to SIGTERM. Is there any particular reason why control-C is not >>> currently handled? >> >> Hi, >> >> I forwarded this email to James - he might have a clue. > > Currently the Windows implementation, when running in console mode, uses > function keys to trigger various Unix signals (see win32_signal_get() > function in win32.c). > > The current code looks like this: > > switch (win32_keyboard_get (ws)) > { > case 0x3B: /* F1 -> USR1 */ > ret = SIGUSR1; > break; > case 0x3C: /* F2 -> USR2 */ > ret = SIGUSR2; > break; > case 0x3D: /* F3 -> HUP */ > ret = SIGHUP; > break; > case 0x3E: /* F4 -> TERM */ > ret = SIGTERM; > break; > } > > > It's probably okay to just make CTRL-c generate a SIGTERM as F4 is > already doing. > > James
Thanks for the comment. In the interactive mode, the console is opened with no ENABLE_PROCESSED_INPUT so ctrl-C will be delivered as key-board input and could be handled just like F4. With nssm, the console is shared with nssm, so ctrl-C is delivered as a signal. I'll send a patch handling both cases. Selva