jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/609579 )
Change subject: [4.0] replace os.system call by subprocess.run as suggested ......................................................................
[4.0] replace os.system call by subprocess.run as suggested
https://docs.python.org/3.5/library/subprocess.html#replacing-os-system
Change-Id: I7448cecc3df54f2056251f82c4a48cf667d834a8 --- M scripts/shell.py 1 file changed, 5 insertions(+), 7 deletions(-)
Approvals: Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/shell.py b/scripts/shell.py index 3223520..2857154 100755 --- a/scripts/shell.py +++ b/scripts/shell.py @@ -14,13 +14,10 @@
If no arguments are given, the pywikibot library will not be loaded. """ -# (C) Pywikibot team, 2014-2018 +# (C) Pywikibot team, 2014-2020 # # Distributed under the terms of the MIT license. # -from __future__ import (absolute_import, division, - print_function, unicode_literals) - import code import sys
@@ -53,9 +50,10 @@
if __name__ == '__main__': if sys.platform == 'win32': - import os - os.system('title Python {} Shell'.format(*sys.version.split(' ', 1))) - del os + import subprocess + subprocess.run('title Python {} Shell' + .format(*sys.version.split(' ', 1)), shell=True) + del subprocess args = [] if sys.argv and sys.argv[0].endswith(('shell', 'shell.py')): args = sys.argv[1:]