Page MenuHomePhabricator

editor detection only supports a single argument
Closed, DeclinedPublic

Description

The Win32 editor detection in pywikibot/config2.py looks for registry entries such as

"Foo.exe" "%1"

It detects the "%1 , and discards everything after it because it pywikibot/editor.py assumes it is a single command.

This is probably a Win32-only problem, however the same problem will occur if the environment variable EDITOR contains additional arguments.

Event Timeline

jayvdb raised the priority of this task from to Lowest.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb subscribed.

editor.py also uses config.editor.lower().endswith('notepad++.exe') , which will fail to match if the program name if quotes are used, such as "C:\My Dir\notepad++.exe"

Xqt subscribed.

This tast no longer match the current code

Change 926170 had a related patch set uploaded (by ElSeiver; author: ElSeiver):

[pywikibot/core@master] TextEditor.editor: Use shlex to parse editor name

https://gerrit.wikimedia.org/r/926170

Change 926170 merged by jenkins-bot:

[pywikibot/core@master] TextEditor.editor: Use shlex to parse editor name

https://gerrit.wikimedia.org/r/926170