3 applicationName
= 'Commit Tool'
9 # PyQt3 and python 2.4 isn't currently available together on
10 # Debian/testing we do therefore use the following quite ugly work
11 # around. The module 'mysubprocess' is just a copy of the 'subprocess'
12 # module from the Python 2.4 distribution.
13 ver
= sys
.version_info
14 if ver
[0] < 2 or (ver
[0] == 2 and ver
[1] <= 3):
16 subprocess
= mysubprocess
23 class ProgramError(Exception):
24 def __init__(self
, program
, err
):
25 Exception.__init
__(self
)
26 self
.program
= program
29 def runProgram(prog
, input=None):
30 debug('runProgram prog: ' + str(prog
) + " input: " + str(input))
34 progStr
= ' '.join(prog
)
37 pop
= subprocess
.Popen(prog
,
38 shell
= type(prog
) is str,
39 stderr
=subprocess
.STDOUT
,
40 stdout
=subprocess
.PIPE
,
41 stdin
=subprocess
.PIPE
)
43 debug("strerror: " + e
.strerror
)
44 raise ProgramError(progStr
, e
.strerror
)
47 pop
.stdin
.write(input)
50 out
= pop
.stdout
.read()
53 debug("error output: " + out
)
54 raise ProgramError(progStr
, out
)
55 debug("output: " + out
.replace('\0', '\n'))