34 def spawn(self, stdin, arglist, *pargs, **kwargs):
35 env = kwargs.pop(
'env',
None)
37 env = os.environ.copy()
39 env.pop(
'GNUNET_FORCE_LOGFILE',
None)
40 self.
proc = subprocess.Popen(arglist, *pargs, env=env, **kwargs)
42 print(
"Failed to spawn a process {0}".format(arglist))
51 stream = self.
stdo if s ==
'stdout' else self.
stde
52 if isinstance(r, str):
58 "Failed to find `{1}' in {0}, which is `{2}' ({3})".
59 format(s, r, stream, len(stream))
63 "Argument `r' should be an instance of re.RegexObject or a special string, but is `{0}'"
66 m = r.search(stream.decode(), flags)
69 "Failed to find `{1}' in {0}, which is is `{2}'".format(
74 stream = stream[m.end():]
81 def read(self, s, size=-1):
82 stream = self.
stdo if s ==
'stdout' else self.
stde
88 result = stream[0:size]
89 new_stream = stream[size:]
91 self.
stdo = new_stream
93 self.
stde = new_stream
def read(self, s, size=-1)
def expect(self, s, r, flags=0)
def spawn(self, stdin, arglist, *pargs, **kwargs)