Show More
@@ -32,15 +32,15 b' def win32_clipboard_get():' | |||||
32 | win32clipboard.CloseClipboard() |
|
32 | win32clipboard.CloseClipboard() | |
33 | return text |
|
33 | return text | |
34 |
|
34 | |||
35 | def osx_clipboard_get(): |
|
35 | def osx_clipboard_get() -> str: | |
36 | """ Get the clipboard's text on OS X. |
|
36 | """ Get the clipboard's text on OS X. | |
37 | """ |
|
37 | """ | |
38 | p = subprocess.Popen(['pbpaste', '-Prefer', 'ascii'], |
|
38 | p = subprocess.Popen(['pbpaste', '-Prefer', 'ascii'], | |
39 | stdout=subprocess.PIPE) |
|
39 | stdout=subprocess.PIPE) | |
40 |
|
|
40 | bytes_, stderr = p.communicate() | |
41 | # Text comes in with old Mac \r line endings. Change them to \n. |
|
41 | # Text comes in with old Mac \r line endings. Change them to \n. | |
42 |
|
|
42 | bytes_ = bytes_.replace(b'\r', b'\n') | |
43 | text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING) |
|
43 | text = py3compat.decode(bytes_) | |
44 | return text |
|
44 | return text | |
45 |
|
45 | |||
46 | def tkinter_clipboard_get(): |
|
46 | def tkinter_clipboard_get(): |
General Comments 0
You need to be logged in to leave comments.
Login now