diff options
-rwxr-xr-x | clip | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -52,8 +52,12 @@ if __name__ == '__main__': clipboard_filepath = '/dev/shm/%s-clipboard' % getpass.getuser() if(sys.stdin.isatty()): # Should write clipboard contents out to stdout - with secure_open(clipboard_filepath, 'rb') as fo: - sys.stdout.buffer.write(fo.read()) + try: + with secure_open(clipboard_filepath, 'rb') as fo: + sys.stdout.buffer.write(fo.read()) + except FileNotFoundError: + # equivalent to an empty file + pass elif(sys.stdout.isatty()): # Should save stdin to clipboard with secure_open(clipboard_filepath, 'wb') as fo: |