blob: 5e378d37504cce0d75886d637ab1650719529b0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import subprocess, os
class ArError(Exception):
pass
class ExecutionError(ArError):
def __init__(self, errcode):
self.error_code = errcode
def print_data(input_file, out_file, tree=None):
cmd = ['ar', 'p', input_file, 'data.tar.gz', 'data.tar.xz']
process = subprocess.Popen(cmd,
stdout=out_file,
close_fds=True, universal_newlines=True, cwd=tree)
stdout = process.communicate()[0]
process.wait()
if process.returncode != 0:
raise ExecutionError(process.returncode)
|