bitbake: utils: Improve remove funciton to handle whitespace
Improve the remove function to better handle cases where path contains special shell chars like whitespaces, '$', ';' or'\'. Thanks to Enrico Scholz for the fix. (Bitbake rev: 617511c9f86cc4ef52457653c8adff582d94bce3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
72ebe0c34f
commit
c78cc0556f
|
@ -536,9 +536,9 @@ def remove(path, recurse=False):
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return
|
||||||
if recurse:
|
if recurse:
|
||||||
import subprocess
|
import subprocess, glob
|
||||||
# shutil.rmtree(name) would be ideal but its too slow
|
# shutil.rmtree(name) would be ideal but its too slow
|
||||||
subprocess.call("rm -rf %s" % path, shell=True)
|
subprocess.call(['rm', '-rf'] + glob.glob(path))
|
||||||
return
|
return
|
||||||
import os, errno, glob
|
import os, errno, glob
|
||||||
for name in glob.glob(path):
|
for name in glob.glob(path):
|
||||||
|
|
Loading…
Reference in New Issue