Show PID in :process error message
See https://www.reddit.com/r/qutebrowser/comments/13tqp55/command_crashed_see_process_for_details/
This commit is contained in:
parent
f26ea37c41
commit
c41f152fa5
|
|
@ -136,6 +136,9 @@ Changed
|
|||
- `:config-diff` now has an `--include-hidden` flag, which also shows
|
||||
internally-set settings.
|
||||
- Improved error messages when `:spawn` can't find an executable.
|
||||
- When a process fails, the error message now suggests using `:process PID` with
|
||||
the correct PID (rather than always showing the latest process, which might not
|
||||
be the failing one)
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ class GUIProcess(QObject):
|
|||
log.procs.error("Process stdout:\n" + self.stdout.strip())
|
||||
if self.stderr:
|
||||
log.procs.error("Process stderr:\n" + self.stderr.strip())
|
||||
message.error(str(self.outcome) + " See :process for details.")
|
||||
message.error(f"{self.outcome} See :process {self.pid} for details.")
|
||||
|
||||
@pyqtSlot()
|
||||
def _on_started(self) -> None:
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@ from qutebrowser.qt import sip
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def proc(qtbot, caplog):
|
||||
def proc(qtbot, caplog, monkeypatch):
|
||||
"""A fixture providing a GUIProcess and cleaning it up after the test."""
|
||||
p = guiprocess.GUIProcess('testprocess')
|
||||
monkeypatch.setattr(p._proc, 'processId', lambda: 1234)
|
||||
yield p
|
||||
if not sip.isdeleted(p._proc) and p._proc.state() != QProcess.ProcessState.NotRunning:
|
||||
with caplog.at_level(logging.ERROR):
|
||||
|
|
@ -429,7 +430,7 @@ def test_exit_unsuccessful(qtbot, proc, message_mock, py_proc, caplog):
|
|||
proc.start(*py_proc('import sys; sys.exit(1)'))
|
||||
|
||||
msg = message_mock.getmsg(usertypes.MessageLevel.error)
|
||||
expected = "Testprocess exited with status 1. See :process for details."
|
||||
expected = "Testprocess exited with status 1. See :process 1234 for details."
|
||||
assert msg.text == expected
|
||||
|
||||
assert not proc.outcome.running
|
||||
|
|
@ -450,7 +451,7 @@ def test_exit_crash(qtbot, proc, message_mock, py_proc, caplog):
|
|||
"""))
|
||||
|
||||
msg = message_mock.getmsg(usertypes.MessageLevel.error)
|
||||
assert msg.text == "Testprocess crashed. See :process for details."
|
||||
assert msg.text == "Testprocess crashed. See :process 1234 for details."
|
||||
|
||||
assert not proc.outcome.running
|
||||
assert proc.outcome.status == QProcess.ExitStatus.CrashExit
|
||||
|
|
@ -471,7 +472,7 @@ def test_exit_unsuccessful_output(qtbot, proc, caplog, py_proc, stream):
|
|||
"""))
|
||||
assert caplog.messages[-2] == 'Process {}:\ntest'.format(stream)
|
||||
assert caplog.messages[-1] == (
|
||||
'Testprocess exited with status 1. See :process for details.')
|
||||
'Testprocess exited with status 1. See :process 1234 for details.')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('stream', ['stdout', 'stderr'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue