Execute the system command at the specified address.
(cmdstring, cwd=None, shell=True)
| 25 | makeimg_new_fls='.' |
| 26 | |
| 27 | def execute_command(cmdstring, cwd=None, shell=True): |
| 28 | """Execute the system command at the specified address.""" |
| 29 | |
| 30 | if shell: |
| 31 | cmdstring_list = cmdstring |
| 32 | |
| 33 | sub = subprocess.Popen(cmdstring_list, cwd=cwd, stdin=subprocess.PIPE, |
| 34 | stdout=subprocess.PIPE, shell=shell, bufsize=8192) |
| 35 | |
| 36 | stdout_str = "" |
| 37 | while sub.poll() is None: |
| 38 | stdout_str += str(sub.stdout.read()) |
| 39 | time.sleep(0.1) |
| 40 | |
| 41 | return stdout_str |
| 42 | |
| 43 | def copy_file(name, path): |
| 44 | res = True |
no test coverage detected