Skip to content

Commit 74857c3

Browse files
committed
Merge branch 'master' into doc_additions
2 parents b9d21a2 + 693ec59 commit 74857c3

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 0.9.17 (TBD, 2019)
22
* Bug Fixes
33
* Fixed a bug when using WSL when all Windows paths have been removed from $PATH
4+
* Fixed a bug when running a cmd2 application on Linux without Gtk libraries installed
45
* Enhancements
56
* No longer treating empty text scripts as an error condition
67

cmd2/clipboard.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
try:
1111
# Try getting the contents of the clipboard
1212
_ = pyperclip.paste()
13-
except (PyperclipException, FileNotFoundError):
13+
except (PyperclipException, FileNotFoundError, ValueError):
1414
# NOTE: FileNotFoundError is for Windows Subsystem for Linux (WSL) when Windows paths are removed from $PATH
15+
# NOTE: ValueError is for headless Linux systems without Gtk installed
1516
can_clip = False
1617
else:
1718
can_clip = True

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ def _redirect_output(self, statement: Statement) -> Tuple[bool, utils.Redirectio
20462046
elif statement.output:
20472047
import tempfile
20482048
if (not statement.output_to) and (not self._can_clip):
2049-
self.perror("Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable")
2049+
self.perror("Cannot redirect to paste buffer; missing 'pyperclip' and/or pyperclip dependencies")
20502050
redir_error = True
20512051

20522052
elif statement.output_to:

tests/test_cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ def test_clipboard_failure(base_app, capsys):
13321332
# Make sure we got the error output
13331333
out, err = capsys.readouterr()
13341334
assert out == ''
1335-
assert "Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable" in err
1335+
assert 'Cannot redirect to paste buffer;' in err and 'pyperclip' in err
13361336

13371337

13381338
class CommandResultApp(cmd2.Cmd):

0 commit comments

Comments
 (0)