changeset 397:50acba85cf9e

no xclip >>> output got lost
author catherine.devlin@gmail.com
date Fri, 17 Sep 2010 11:32:36 -0400
parents e60e2c15f026
children 7812e00ff5b1
files cmd2.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Thu Sep 16 07:38:26 2010 -0400
+++ b/cmd2.py	Fri Sep 17 11:32:36 2010 -0400
@@ -787,6 +787,9 @@
             self.redirect = subprocess.Popen(statement.parsed.pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
             sys.stdout = self.stdout = self.redirect.stdin
         elif statement.parsed.output:
+            if (not statement.parsed.outputTo) and (not can_clip):
+                self.perror('Cannot redirect to paste buffer; install ``xclip`` and re-run to enable')
+                return
             self.kept_state = Statekeeper(self, ('stdout',))            
             self.kept_sys = Statekeeper(sys, ('stdout',))
             if statement.parsed.outputTo: