Executes arbitrary shell command >>> shellExec('echo 1').strip() == '1' True
(cmd)
| 2378 | return width or default |
| 2379 | |
| 2380 | def shellExec(cmd): |
| 2381 | """ |
| 2382 | Executes arbitrary shell command |
| 2383 | |
| 2384 | >>> shellExec('echo 1').strip() == '1' |
| 2385 | True |
| 2386 | """ |
| 2387 | |
| 2388 | retVal = "" |
| 2389 | |
| 2390 | try: |
| 2391 | retVal = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0] or "" |
| 2392 | except Exception as ex: |
| 2393 | retVal = getSafeExString(ex) |
| 2394 | finally: |
| 2395 | retVal = getText(retVal) |
| 2396 | |
| 2397 | return retVal |
| 2398 | |
| 2399 | def clearConsoleLine(forceOutput=False): |
| 2400 | """ |
searching dependent graphs…