Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90203f5

Browse files
committed
Don't use Popen(..., shell=True).
1 parent e8120cf commit 90203f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def report_memory(i=0): # argument may go away
805805
pid = os.getpid()
806806
if sys.platform == 'sunos5':
807807
try:
808-
a2 = Popen('ps -p %d -o osz' % pid, shell=True,
808+
a2 = Popen(['ps', '-p', '%d' % pid, '-o', 'osz'],
809809
stdout=PIPE).stdout.readlines()
810810
except OSError:
811811
raise NotImplementedError(
@@ -814,7 +814,7 @@ def report_memory(i=0): # argument may go away
814814
mem = int(a2[-1].strip())
815815
elif sys.platform == 'linux':
816816
try:
817-
a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
817+
a2 = Popen(['ps', '-p', '%d' % pid, '-o', 'rss,sz'],
818818
stdout=PIPE).stdout.readlines()
819819
except OSError:
820820
raise NotImplementedError(
@@ -823,7 +823,7 @@ def report_memory(i=0): # argument may go away
823823
mem = int(a2[1].split()[1])
824824
elif sys.platform == 'darwin':
825825
try:
826-
a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
826+
a2 = Popen(['ps', '-p', '%d' % pid, '-o', 'rss,vsz'],
827827
stdout=PIPE).stdout.readlines()
828828
except OSError:
829829
raise NotImplementedError(

0 commit comments

Comments
 (0)