Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
runprog=r'"%s"'%self._get_prog(prog)
cmd=' '.join([runprog,args])
dotargs = shlex.split(cmd)
p = subprocess.Popen(dotargs,
shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=False)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
# Use threading to avoid blocking
data = []
errors = []
threads = [PipeReader(data, child_stdout),
PipeReader(errors, child_stderr)]
for t in threads:
t.start()
self.write(child_stdin)
child_stdin.close()
for t in threads:
t.join()
if data==[]:
raise IOError(b''.join(errors))
if len(errors)>0:
warnings.warn(b''.join(errors),RuntimeWarning)
return b"".join(data)
cmd = ' '.join([runprog, args])
dotargs = shlex.split(cmd)
p = subprocess.Popen(dotargs,
shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=False)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
# Use threading to avoid blocking
data = []
errors = []
threads = [PipeReader(data, child_stdout),
PipeReader(errors, child_stderr)]
for t in threads:
t.start()
self.write(child_stdin)
child_stdin.close()
for t in threads:
t.join()
p.wait()
if not data:
raise IOError(b"".join(errors).decode(self.encoding))
if len(errors) > 0:
warnings.warn(b"".join(errors).decode(self.encoding), RuntimeWarning)
return b"".join(data)
cmd=' '.join([runprog,args])
dotargs = shlex.split(cmd)
p = subprocess.Popen(dotargs,
shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=False)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
# Use threading to avoid blocking
data = []
errors = []
threads = [PipeReader(data, child_stdout),
PipeReader(errors, child_stderr)]
for t in threads:
t.start()
self.write(child_stdin)
child_stdin.close()
for t in threads:
t.join()
if data==[]:
raise IOError(b''.join(errors))
if len(errors)>0:
warnings.warn(b''.join(errors),RuntimeWarning)
return b"".join(data)
runprog = r'"%s"' % self._get_prog(prog)
cmd = ' '.join([runprog, args])
dotargs = shlex.split(cmd)
p = subprocess.Popen(dotargs,
shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=False)
(child_stdin,
child_stdout,
child_stderr) = (p.stdin, p.stdout, p.stderr)
# Use threading to avoid blocking
data = []
errors = []
threads = [PipeReader(data, child_stdout),
PipeReader(errors, child_stderr)]
for t in threads:
t.start()
self.write(child_stdin)
child_stdin.close()
for t in threads:
t.join()
p.wait()
if not data:
raise IOError(b"".join(errors).decode(self.encoding))
if len(errors) > 0:
warnings.warn(b"".join(errors).decode(self.encoding), RuntimeWarning)