summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-04-23 10:42:34 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-04-23 10:43:15 +0200
commit55a2f68d95798797ba788bfe50e8dbf461957cd9 (patch)
treeb79e4d126362fe267c33e63224c130e191ea33c5
parent57a8f13393dbe7dc3971f28a13fc518d924eb149 (diff)
downloadqutebrowser-55a2f68d95798797ba788bfe50e8dbf461957cd9.tar.gz
qutebrowser-55a2f68d95798797ba788bfe50e8dbf461957cd9.zip
Fix :spawn -u -o
Fixes #6407 (cherry picked from commit c7b3559d820ebdc8b3077fce3d782e6ab81cb732)
-rw-r--r--qutebrowser/browser/commands.py3
-rw-r--r--qutebrowser/commands/userscripts.py10
-rw-r--r--tests/end2end/features/spawn.feature6
3 files changed, 14 insertions, 5 deletions
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index 23e42d66d..e9653ae19 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -1099,8 +1099,7 @@ class CommandDispatcher:
try:
runner = self._run_userscript(
s, cmd, args, verbose, output_messages, count)
- runner.finished.connect(functools.partial(
- _on_proc_finished, runner.proc))
+ runner.finished.connect(_on_proc_finished)
except cmdutils.CommandError as e:
message.error(str(e))
diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py
index f74d3ef59..70c639207 100644
--- a/qutebrowser/commands/userscripts.py
+++ b/qutebrowser/commands/userscripts.py
@@ -108,10 +108,11 @@ class _BaseUserscriptRunner(QObject):
Signals:
got_cmd: Emitted when a new command arrived and should be executed.
finished: Emitted when the userscript finished running.
+ arg: The finished GUIProcess object.
"""
got_cmd = pyqtSignal(str)
- finished = pyqtSignal()
+ finished = pyqtSignal(guiprocess.GUIProcess)
def __init__(self, parent=None):
super().__init__(parent)
@@ -288,8 +289,10 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner):
self._reader.cleanup()
self._reader.deleteLater()
self._reader = None
+
+ proc = self.proc
super()._cleanup()
- self.finished.emit()
+ self.finished.emit(proc)
class _WindowsUserscriptRunner(_BaseUserscriptRunner):
@@ -321,8 +324,9 @@ class _WindowsUserscriptRunner(_BaseUserscriptRunner):
log.misc.error("Invalid unicode in userscript output: {}"
.format(e))
+ proc = self.proc
super()._cleanup()
- self.finished.emit()
+ self.finished.emit(proc)
@pyqtSlot()
def on_proc_error(self):
diff --git a/tests/end2end/features/spawn.feature b/tests/end2end/features/spawn.feature
index 1c360893c..e7dfaee6c 100644
--- a/tests/end2end/features/spawn.feature
+++ b/tests/end2end/features/spawn.feature
@@ -44,8 +44,14 @@ Feature: :spawn
When I run :spawn -u -m (echo-exe) Message 2
Then the message "Message 2" should be shown
+ Scenario: Running :spawn with -u -o
+ When I run :spawn -u -o (echo-exe) Message 3
+ And I wait for "load status for * url='qute://process/*'>: LoadStatus.success" in the log
+ Then the page should contain the plaintext "Message 3"
+
@posix
Scenario: Running :spawn with userscript
+ Given I clean up open tabs
When I open data/hello.txt
And I run :spawn -u (testdata)/userscripts/open_current_url
And I wait until data/hello.txt is loaded