Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT return
(cmd)
| 544 | |
| 545 | |
| 546 | def system(cmd): |
| 547 | """Win32 version of os.system() that works with network shares. |
| 548 | |
| 549 | Note that this implementation returns None, as meant for use in IPython. |
| 550 | |
| 551 | Parameters |
| 552 | ---------- |
| 553 | cmd : str |
| 554 | A command to be executed in the system shell. |
| 555 | |
| 556 | Returns |
| 557 | ------- |
| 558 | None : we explicitly do NOT return the subprocess status code, as this |
| 559 | utility is meant to be used extensively in IPython, where any return value |
| 560 | would trigger :func:`sys.displayhook` calls. |
| 561 | """ |
| 562 | with AvoidUNCPath() as path: |
| 563 | if path is not None: |
| 564 | cmd = '"pushd %s &&"%s' % (path, cmd) |
| 565 | with Win32ShellCommandController(cmd) as scc: |
| 566 | scc.run() |
| 567 | |
| 568 | |
| 569 | if __name__ == "__main__": |
no test coverage detected