From: David Douard <[email protected]>
There is no need for this, and it is always best not to use it if not relly
needed.
Also pass cmd to Popen as list instead of str.
---
source/new-driver | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/source/new-driver b/source/new-driver
index e6443d6..8246391 100755
--- a/source/new-driver
+++ b/source/new-driver
@@ -56,7 +56,8 @@ def new_driver():
tmp = tempfile.mkdtemp()
try:
os.chdir(tmp)
- process = Popen("git clone --depth=1 " + LIBSR, shell=True,
stderr=PIPE)
+ process = Popen(['git', 'clone', '--depth=1', LIBSR],
+ stdout=PIPE, stderr=PIPE)
out, err = process.communicate()
if process.returncode:
raise Exception(err.decode())
@@ -132,12 +133,14 @@ def do_driverskel(gitdir):
def make_patch(gitdir):
os.chdir(gitdir)
- command('git add src/hardware/' + names['short'])
- cmd = 'git commit -m "%s: Initial driver skeleton." ' % names['short']
- cmd += 'configure.ac Makefile.am src/hardware/' + names['short']
+ command(['git', 'add', 'src/hardware/' + names['short']])
+ cmd = ['git', 'commit',
+ '-m', '%s: Initial driver skeleton.' % names['short'],
+ 'configure.ac', 'Makefile.am',
+ 'src/hardware/' + names['short']]
command(cmd)
- cmd = "git format-patch HEAD~1"
- out, err = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate()
+ cmd = ['git', 'format-patch', 'HEAD~1']
+ out, err = Popen(cmd, stdout=PIPE, stderr=PIPE).communicate()
if err:
raise Exception(err.decode())
patch = out.decode().strip()
@@ -146,7 +149,7 @@ def make_patch(gitdir):
def command(cmd):
- out, err = Popen(cmd, shell=True, stderr=PIPE).communicate()
+ out, err = Popen(cmd, stderr=PIPE).communicate()
if err:
raise Exception(err.decode())
--
2.1.4
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel