diff options
-rw-r--r-- | src/main/TweetShell.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java index 4ba50f3..231007f 100644 --- a/src/main/TweetShell.java +++ b/src/main/TweetShell.java @@ -49,6 +49,14 @@ public class TweetShell implements TwitterApi.PinSupplier { // and something that prints tweets to console. resultListeners.register(new StreamHandler()); // see getPossibleTargets() for more listener types. + + // register shutdown listener to prevent corruption on SIGINT + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { + @Override + public void run() { + safeClose(); + } + })); } private TwitterApi getApi() throws IOException { |