Run command with arguments. Wait for command to complete or for timeout seconds, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"])
(*popenargs, timeout=None, **kwargs)
| 385 | |
| 386 | |
| 387 | def call(*popenargs, timeout=None, **kwargs): |
| 388 | """Run command with arguments. Wait for command to complete or |
| 389 | for timeout seconds, then return the returncode attribute. |
| 390 | |
| 391 | The arguments are the same as for the Popen constructor. Example: |
| 392 | |
| 393 | retcode = call(["ls", "-l"]) |
| 394 | """ |
| 395 | with Popen(*popenargs, **kwargs) as p: |
| 396 | try: |
| 397 | return p.wait(timeout=timeout) |
| 398 | except: # Including KeyboardInterrupt, wait handled that. |
| 399 | p.kill() |
| 400 | # We don't call p.wait() again as p.__exit__ does that for us. |
| 401 | raise |
| 402 | |
| 403 | |
| 404 | def check_call(*popenargs, **kwargs): |
no test coverage detected
searching dependent graphs…