summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-02 11:13:33 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-02 11:13:33 -0400
commit91fc975ba2bf0414624aa9c263ddf441beadfa3d (patch)
treea4c7489d7d2f96a588b2d262f844038e9414acbd /cmd2.py
parent9054a211b60f55e00ea446433444c0bf4970a50f (diff)
downloadcmd2-git-91fc975ba2bf0414624aa9c263ddf441beadfa3d.tar.gz
Removed unnecessary try/except in do_shell
Since in the subprocess.Popen() call, shell=True and stderr=sys.stderr, errors get printed on stderr. There is no need to catch an exception.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/cmd2.py b/cmd2.py
index 9d1a7160..87a28cd2 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -479,9 +479,7 @@ class Cmd(cmd.Cmd):
self.initial_stdout = sys.stdout
self.history = History()
self.pystate = {}
- # noinspection PyUnresolvedReferences
- self.keywords = self.reserved_words + [fname[3:] for fname in dir(self)
- if fname.startswith('do_')]
+ self.keywords = self.reserved_words + [fname[3:] for fname in dir(self) if fname.startswith('do_')]
self.parser_manager = ParserManager(redirector=self.redirector, terminators=self.terminators,
multilineCommands=self.multilineCommands,
legalChars=self.legalChars, commentGrammars=self.commentGrammars,
@@ -1142,11 +1140,8 @@ class Cmd(cmd.Cmd):
"""Execute a command as if at the OS prompt.
Usage: shell <command> [arguments]"""
- try:
- proc = subprocess.Popen(command, stdout=self.stdout, stderr=sys.stderr, shell=True)
- proc.communicate()
- except FileNotFoundError as e:
- self.perror(e.strerror, traceback_war=False)
+ proc = subprocess.Popen(command, stdout=self.stdout, stderr=sys.stderr, shell=True)
+ proc.communicate()
def path_complete(self, text, line, begidx, endidx, dir_exe_only=False, dir_only=False):
"""Method called to complete an input line by local file system path completion.