|
16 | 16 | """ |
17 | 17 |
|
18 | 18 | import re |
19 | | -import subprocess |
20 | 19 |
|
21 | 20 | from lstools_base import MbedLsToolsBase |
22 | 21 |
|
@@ -127,10 +126,8 @@ def get_dev_by_id_cmd(self, subdir): |
127 | 126 | @return tuple(stdout lines, retcode) |
128 | 127 | """ |
129 | 128 | cmd = 'ls -oA /dev/' + subdir + '/by-id/' |
130 | | - if self.DEBUG_FLAG: |
131 | | - self.debug(self.get_dev_by_id_cmd.__name__, cmd) |
132 | | - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
133 | | - return (p.stdout.readlines(), p.wait()) |
| 129 | + _stdout, _, retval = self.run_cli_process(cmd) |
| 130 | + return (_stdout.splitlines(), retval) |
134 | 131 |
|
135 | 132 | def get_dev_by_id_process(self, lines, retval): |
136 | 133 | """! Remove unnecessary lines from command line output |
@@ -159,13 +156,14 @@ def get_mounts(self): |
159 | 156 | """ |
160 | 157 | result = [] |
161 | 158 | cmd = 'mount | grep vfat' |
| 159 | + |
162 | 160 | if self.DEBUG_FLAG: |
163 | 161 | self.debug(self.get_mounts.__name__, cmd) |
164 | 162 |
|
165 | | - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
166 | | - retval = p.wait() |
| 163 | + _stdout, _, retval = self.run_cli_process(cmd) |
| 164 | + |
167 | 165 | if not retval: |
168 | | - for line in p.stdout.readlines(): |
| 166 | + for line in _stdout.splitlines(): |
169 | 167 | line = line.rstrip() |
170 | 168 | result.append(line) |
171 | 169 | if self.DEBUG_FLAG: |
|
0 commit comments