Fix starting when sys.stderr is None
This commit is contained in:
parent
afcb018ee2
commit
1d87eee4d7
@ -66,6 +66,7 @@ Fixed
|
|||||||
- Fixed updating the tab index in the statusbar when opening a background tab
|
- Fixed updating the tab index in the statusbar when opening a background tab
|
||||||
- Fixed a crash when entering `:-- ` in the commandline
|
- Fixed a crash when entering `:-- ` in the commandline
|
||||||
- Fixed `:debug-console` with PyQt 5.6
|
- Fixed `:debug-console` with PyQt 5.6
|
||||||
|
- Fixed qutebrowser not starting when `sys.stderr` is `None`
|
||||||
|
|
||||||
v0.6.2
|
v0.6.2
|
||||||
------
|
------
|
||||||
|
@ -123,7 +123,8 @@ def init_faulthandler(fileobj=sys.__stderr__):
|
|||||||
# start.
|
# start.
|
||||||
return
|
return
|
||||||
faulthandler.enable(fileobj)
|
faulthandler.enable(fileobj)
|
||||||
if hasattr(faulthandler, 'register') and hasattr(signal, 'SIGUSR1'):
|
if (hasattr(faulthandler, 'register') and hasattr(signal, 'SIGUSR1') and
|
||||||
|
sys.stderr is not None):
|
||||||
# If available, we also want a traceback on SIGUSR1.
|
# If available, we also want a traceback on SIGUSR1.
|
||||||
# pylint: disable=no-member,useless-suppression
|
# pylint: disable=no-member,useless-suppression
|
||||||
faulthandler.register(signal.SIGUSR1)
|
faulthandler.register(signal.SIGUSR1)
|
||||||
|
33
tests/unit/misc/test_earlyinit.py
Normal file
33
tests/unit/misc/test_earlyinit.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright 2016 Florian Bruhin (The-Compiler) <mail@qutebrowser.org>
|
||||||
|
#
|
||||||
|
# This file is part of qutebrowser.
|
||||||
|
#
|
||||||
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Test qutebrowser.misc.earlyinit."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from qutebrowser.misc import earlyinit
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('attr', ['stderr', '__stderr__'])
|
||||||
|
def test_init_faulthandler_stderr_none(monkeypatch, attr):
|
||||||
|
"""Make sure init_faulthandler works when sys.stderr/__stderr__ is None."""
|
||||||
|
monkeypatch.setattr(sys, attr, None)
|
||||||
|
earlyinit.init_faulthandler()
|
Loading…
Reference in New Issue
Block a user