Mercurial > python-cmd2
comparison cmd2.py @ 395:9f9c69fbb78f
swallow xclip error
author | catherine.devlin@gmail.com |
---|---|
date | Tue, 07 Sep 2010 07:25:49 -0400 |
parents | be4194f41916 |
children | e60e2c15f026 |
comparison
equal
deleted
inserted
replaced
394:fbd780b5994b | 395:9f9c69fbb78f |
---|---|
185 raise OSError, pastebufferr % ('pywin32', 'Download from http://sourceforge.net/projects/pywin32/') | 185 raise OSError, pastebufferr % ('pywin32', 'Download from http://sourceforge.net/projects/pywin32/') |
186 write_to_paste_buffer = get_paste_buffer | 186 write_to_paste_buffer = get_paste_buffer |
187 else: | 187 else: |
188 can_clip = False | 188 can_clip = False |
189 try: | 189 try: |
190 subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 190 subprocess.check_call('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) |
191 can_clip = True | 191 can_clip = True |
192 except AttributeError: # check_call not defined, Python < 2.5 | 192 except AttributeError: # check_call not defined, Python < 2.5 |
193 teststring = 'Testing for presence of xclip.' | 193 teststring = 'Testing for presence of xclip.' |
194 xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 194 xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
195 xclipproc.stdin.write(teststring) | 195 xclipproc.stdin.write(teststring) |
649 - args: command ends | 649 - args: command ends |
650 - multilineCommand: multiline | 650 - multilineCommand: multiline |
651 - terminator: ['\n', '\n'] | 651 - terminator: ['\n', '\n'] |
652 - terminator: ['\n', '\n'] | 652 - terminator: ['\n', '\n'] |
653 ''' | 653 ''' |
654 tstr = 'multiline command /* with comment complete */ is done;' | |
655 outputParser = (pyparsing.Literal('>>') | (pyparsing.WordStart() + '>') | pyparsing.Regex('[^=]>'))('output') | 654 outputParser = (pyparsing.Literal('>>') | (pyparsing.WordStart() + '>') | pyparsing.Regex('[^=]>'))('output') |
656 | 655 |
657 terminatorParser = pyparsing.Or([(hasattr(t, 'parseString') and t) or pyparsing.Literal(t) for t in self.terminators])('terminator') | 656 terminatorParser = pyparsing.Or([(hasattr(t, 'parseString') and t) or pyparsing.Literal(t) for t in self.terminators])('terminator') |
658 stringEnd = pyparsing.stringEnd ^ '\nEOF' | 657 stringEnd = pyparsing.stringEnd ^ '\nEOF' |
659 self.multilineCommand = pyparsing.Or([pyparsing.Keyword(c, caseless=self.case_insensitive) for c in self.multilineCommands])('multilineCommand') | 658 self.multilineCommand = pyparsing.Or([pyparsing.Keyword(c, caseless=self.case_insensitive) for c in self.multilineCommands])('multilineCommand') |