Allow passing args to spawn from :hint.

Instead of creating a new guiprocess manually, just pass the args along
to the spawn command so it can accept args like -v.

Addresses part of #797 by allowing `hint -- all spawn -v echo`.
`hint all spawn -v echo` is still not supported.
This commit is contained in:
Ryan Roden-Corrent 2016-05-19 20:37:57 -04:00
parent 0f8b298fad
commit 0300f03ebc
2 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,6 @@ from qutebrowser.keyinput import modeman, modeparsers
from qutebrowser.browser import webelem
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
from qutebrowser.utils import usertypes, log, qtutils, message, objreg, utils
from qutebrowser.misc import guiprocess
ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label'])
@ -625,9 +624,8 @@ class HintManager(QObject):
"""
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
args = context.get_args(urlstr)
cmd, *args = args
proc = guiprocess.GUIProcess(self._win_id, what='command', parent=self)
proc.start(cmd, args)
commandrunner = runners.CommandRunner(self._win_id)
commandrunner.run_safely('spawn ' + ' '.join(args))
def _resolve_url(self, elem, baseurl):
"""Resolve a URL and check if we want to keep it.

View File

@ -44,6 +44,12 @@ Feature: Using hints
And I run :fake-key -g <Esc>
Then no crash should happen
Scenario: Using :hint spawn with flags and -- (issue 797)
When I open data/hints/link.html
And I run :hint -- all spawn -v echo
And I run :follow-hint a
Then the message "Command exited successfully." should be shown
@xfail
Scenario: Using :hint spawn with flags (issue 797)
When I open data/hints/html/simple.html