summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-08-23 15:39:24 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-08-23 17:35:46 -0700
commit222017927663f41105fc008f3fd81819a64e6eb8 (patch)
tree5fc8d8ceabaa59e12e796f649689bf4720cf9cc2
parent5f96f0dffcc7dba76c1f1a96e624fa3ab46e7b6e (diff)
commands/globals: Only set stdin to a pipe if there is data
Otherwise the editor will crash. I can't figure out for the life of me to test this. I thought that I would be able to do something like detect if stdin is a tty or something else, but that doesn't seem to work. Fixes #1137
-rw-r--r--alot/commands/globals.py2
-rw-r--r--tests/commands/global_test.py3
2 files changed, 1 insertions, 4 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 787ff450..565bd742 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -268,7 +268,7 @@ class ExternalCommand(Command):
def thread_code(*_):
try:
proc = subprocess.Popen(self.cmdlist, shell=self.shell,
- stdin=subprocess.PIPE,
+ stdin=subprocess.PIPE if stdin else None,
stderr=subprocess.PIPE)
except OSError as e:
return str(e)
diff --git a/tests/commands/global_test.py b/tests/commands/global_test.py
index e93a11d3..9489c909 100644
--- a/tests/commands/global_test.py
+++ b/tests/commands/global_test.py
@@ -25,8 +25,6 @@ import mock
from alot.commands import globals as g_commands
-from .. import utilities
-
class Stop(Exception):
"""exception for stopping testing of giant unmanagable functions."""
@@ -136,7 +134,6 @@ class TestExternalCommand(unittest.TestCase):
cmd.apply(ui)
ui.notify.assert_not_called()
- @utilities.expected_failure
def test_no_spawn_no_stdin_attached(self):
ui = mock.Mock()
cmd = g_commands.ExternalCommand(u'test -t 0', refocus=False)