나는 child_process
모듈과 나무 딸기 파이에 mpg123 플레이어를 사용하여 node.js에서 mp3 웹 라디오를 만들려고합니다. 여기 Node.js 자식 프로세스에 쓰기
Error: write EPIPE
at exports._errnoException (util.js:1026:11)
at WriteWrap.afterWrite (net.js:795:14)
내가 그것을 테스트하려 내용은 다음과 같습니다
//create a subprocess
var test = childProcess.exec('ls /home/pi/music');
//pipe all the output to the process output
test.stdout.pipe(process.stdout);
test.stderr.pipe(process.stderr);
test.stdin.setEncoding('utf-8');
//here I just want to write a key to the subprocess
test.stdin.write('q');
test.stdin.end()
누구나 알고, 무엇을 모든 일이 끝날 때까지는 작성된 쓰기 스트림이 닫히지 않을 것입니다.
물론 내가 아직 이것에 대한 구글에서 검색 :
Child_process throw an Error: write EPIPE
https://github.com/nodejs/node/issues/2985
https://nodejs.org/api/child_process.html#child_process_subprocess_stdin
https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback
도와주세요!
'ls/home/pi/music'에 대한 하위 프로세스가 출력에 다른 것을 쓰려고 시도하기 전에 종료되지 않습니까? – dpetrini
나는 ** 프로세스가 ** 종료 될 것이고 이것이 에러의 원인이라고 생각한다. 그러나 나는 이것을 어떻게 멈출 지 모른다 : c. 멈추지 않으면 오류가 발생하지 않을 것이라고 생각합니다 ... –
다른 쪽에서 이미 끝난 상태에서 stind 스트림을'.end()'하기 때문에 그렇지 않습니까? – n00dl3