aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclip8
1 files changed, 6 insertions, 2 deletions
diff --git a/clip b/clip
index 29e73e3..f61b751 100755
--- a/clip
+++ b/clip
@@ -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: