/usr/share/apertium/dbus-1/command_line.py is in apertium-dbus 0.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | def call(cmdline, _in):
import os
"""A convenience function to invoke a subprocess with the
parameter list name (where the first argument is the name
of an executable). The subprocess is fed the contents of
input via stdin. We collect the output of both stdout and
stderr from the subprocess. If stderr is not empty, we
raise an exception, otherwise we return the contents of
stdout."""
child_in, child_out, child_err = os.popen3(" ".join(cmdline))
child_in.write(_in)
child_in.close() # You MUST close the child's stdin to get output from some programs
out = child_out.read()
child_out.close()
err = child_err.read()
child_err.close()
return out, err
class OsCommand(object):
def __init__(self, cmd):
self.cmd = cmd
def communicate(self, _input):
print "calling", self.cmd
return call(self.cmd, _input)
|