jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/926170 )

Change subject: TextEditor.editor: Use shlex to parse editor name
......................................................................

TextEditor.editor: Use shlex to parse editor name

Allows spaces in environment variables, e.g., `code -w`.
If `OSWIN32` is `True`, the behavior will be unchanged.

Bug: T323078
Bug: T102465
Change-Id: I31f4d4f5660cc6e6085e4494e161e1ca80876dbd
---
M pywikibot/editor.py
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 29e4829..9a20282 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -5,6 +5,7 @@
 # Distributed under the terms of the MIT license.
 #
 import os
+import shlex
 import subprocess
 import tempfile
 from pathlib import Path
@@ -83,7 +84,8 @@
             command = []

         # See T102465 for problems relating to using self.editor unparsed.
-        command = [self.editor] + command + [file_name]
+        editor_cmd = [self.editor] if OSWIN32 else shlex.split(self.editor)
+        command = editor_cmd + command + [file_name]
         pywikibot.log(f'Running editor: {self._concat(command)}')
         return command


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/926170
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I31f4d4f5660cc6e6085e4494e161e1ca80876dbd
Gerrit-Change-Number: 926170
Gerrit-PatchSet: 3
Gerrit-Owner: ElSeiver <ellis.sei...@gmail.com>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Welcome, new contributor! <sse...@wikimedia.org>
Gerrit-CC: Zoranzoki21 <zorandori4...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to