GfshSignalHandler extends AbstractSignalNotificationHandler implements SignalHandler { protected void handleDefault(final org.apache.geode.unsafe.internal.sun.misc.Signal sig, final ConsoleReader consoleReader) throws IOException { final Signal signal = Signal.valueOfName(sig.getName()); switch (signal) { case SIGINT: if (consoleReader != null) { String prompt = consoleReader.getPrompt(); consoleReader.resetPromptLine(prompt, "", -1); } break; default: final SignalHandler handler = getOriginalSignalHandler(signal); if (handler != null) { handler.handle(sig); } } } GfshSignalHandler(); @Override void handle(final org.apache.geode.unsafe.internal.sun.misc.Signal sig);  }
@Test public void signalHandlerRespondsToSIGINTByClearingPrompt() throws IOException { GfshSignalHandler signalHandler = new GfshSignalHandler(); ConsoleReader consoleReader = mock(ConsoleReader.class); when(consoleReader.getPrompt()).thenReturn(PROMPT); signalHandler.handleDefault(SIGINT, consoleReader); verify(consoleReader, times(1)).resetPromptLine(eq(PROMPT), eq(""), eq(END_OF_LINE)); }