0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pyuv
def on_read(pipe, data, error):
print('data: ' + str(data))
def on_exit(process, exit_status, term_signal):
print('Process Terminated - exit code: ' + str(exit_status))
def start():
stdin_pipe = pyuv.Pipe(pyuv.Loop.default_loop())
stdout_pipe = pyuv.Pipe(pyuv.Loop.default_loop())
stderr_pipe = pyuv.Pipe(pyuv.Loop.default_loop())
stdout_pipe.start_read(on_read)
stderr_pipe.start_read(on_read)
stdio = [pyuv.StdIO(stream=stdin_pipe, flags=pyuv.UV_CREATE_PIPE | pyuv.UV_READABLE_PIPE),
pyuv.StdIO(stream=stdout_pipe, flags=pyuv.UV_CREATE_PIPE | pyuv.UV_WRITABLE_PIPE),
pyuv.StdIO(stream=stderr_pipe, flags=pyuv.UV_CREATE_PIPE | pyuv.UV_WRITABLE_PIPE)]
process = pyuv.Process(pyuv.Loop.default_loop())
process.spawn(loop=pyuv.Loop.default_loop(),
args=['/usr/bin/wget', 'http://www.google.com'],
exit_callback=on_exit,
stdio=stdio)
pyuv.Loop.default_loop().run()
if __name__ == '__main__':
start()
작동 파이프 인스턴스의 'start_read() 호출을 댓글 달기 Segmentation fault (core dumped)
를 산출,하지만 포기하지 않습니다 stdout과 stderr.
무엇이 누락 되었습니까?
pyuv의 생성 된 프로세스에서 stdout 및 stderr를 캡처하는 올바른 방법이 아닌가요?