From ca3f08690ee746c510ea65ae0a25a767a7b17dd8 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sun, 10 Feb 2008 11:39:29 +0000 Subject: [PATCH] Gracefully handle ctrl-d, and don't exit on blank command. --- deluge/ui/null/deluge_shell.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deluge/ui/null/deluge_shell.py b/deluge/ui/null/deluge_shell.py index b736c6a9f..e59b0d2bb 100755 --- a/deluge/ui/null/deluge_shell.py +++ b/deluge/ui/null/deluge_shell.py @@ -291,9 +291,13 @@ class NullUI: readline.read_init_file() while True: - inp = raw_input("> ") - if len(inp) == 0: break - inp = inp.strip().split(" ") + try: + inp = raw_input("> ").strip() + except: + inp = 'quit' + + if len(inp) == 0: continue + inp = inp.split(" ") print "" cmd = inp[0]