(args, callback=None, add_path=None, cwd=None)
| 20 | |
| 21 | |
| 22 | def cexec(args, callback=None, add_path=None, cwd=None): |
| 23 | env = None |
| 24 | if add_path: |
| 25 | import copy |
| 26 | env = copy.copy(os.environ) |
| 27 | env['PATH'] = add_path + os.path.pathsep + env['PATH'] |
| 28 | p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd) |
| 29 | output, err = p.communicate() |
| 30 | code = p.returncode |
| 31 | |
| 32 | if code != 0 and callback: |
| 33 | callback(args, code, output, err) |
| 34 | else: |
| 35 | return output, err, code |
| 36 | |
| 37 | |
| 38 | def curl(url, body=None): |
no outgoing calls
no test coverage detected