mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 15:55:28 +00:00
Add small delay before unlinking file in external viewer fixes #4152
In some cases, such as with firefox, the file is removed before the viewer is finished loading.
This commit is contained in:
parent
2aacf94a63
commit
b74a2f4e45
@ -12,6 +12,7 @@ Unreleased: mitmproxy next
|
|||||||
* Revamp onboarding app (@mhils)
|
* Revamp onboarding app (@mhils)
|
||||||
* Add ASGI support for embedded apps (@mhils)
|
* Add ASGI support for embedded apps (@mhils)
|
||||||
* Updated raw exports to not remove headers (@wchasekelley)
|
* Updated raw exports to not remove headers (@wchasekelley)
|
||||||
|
* Fix file unlinking before external viewer finishes loading (@wchasekelley)
|
||||||
|
|
||||||
* --- TODO: add new PRs above this line ---
|
* --- TODO: add new PRs above this line ---
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import typing # noqa
|
import typing # noqa
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import threading
|
||||||
|
|
||||||
import urwid
|
import urwid
|
||||||
|
|
||||||
@ -171,7 +172,9 @@ class ConsoleMaster(master.Master):
|
|||||||
signals.status_message.send(
|
signals.status_message.send(
|
||||||
message="Can't start external viewer: %s" % " ".join(c)
|
message="Can't start external viewer: %s" % " ".join(c)
|
||||||
)
|
)
|
||||||
os.unlink(name)
|
# small delay before removing the file
|
||||||
|
t = threading.Timer(1.0, os.unlink, args=[name])
|
||||||
|
t.start()
|
||||||
|
|
||||||
def set_palette(self, opts, updated):
|
def set_palette(self, opts, updated):
|
||||||
self.ui.register_palette(
|
self.ui.register_palette(
|
||||||
|
Loading…
Reference in New Issue
Block a user