Run command with arguments. Wait for command to complete or timeout, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"])
(*popenargs, timeout=None, **kwargs)
| 379 | |
| 380 | |
| 381 | def call(*popenargs, timeout=None, **kwargs): |
| 382 | """Run command with arguments. Wait for command to complete or |
| 383 | timeout, then return the returncode attribute. |
| 384 | |
| 385 | The arguments are the same as for the Popen constructor. Example: |
| 386 | |
| 387 | retcode = call(["ls", "-l"]) |
| 388 | """ |
| 389 | with Popen(*popenargs, **kwargs) as p: |
| 390 | try: |
| 391 | return p.wait(timeout=timeout) |
| 392 | except: # Including KeyboardInterrupt, wait handled that. |
| 393 | p.kill() |
| 394 | # We don't call p.wait() again as p.__exit__ does that for us. |
| 395 | raise |
| 396 | |
| 397 | |
| 398 | def check_call(*popenargs, **kwargs): |