2
외부 프로세스의 표준 입력에 쓸 수 있습니까? NIF가 유일한 옵션입니까?엘릭서에서 외부 프로세스의 표준 입력에 쓰는 방법
엘릭서, 블록에서 시작하고 사용자 입력을 기다리는 과정 :
pid = spawn(fn ->
System.cmd("sh", [
Path.join([System.cwd, "sh", "wait_for_input"]),
"Hello world"
])
end)
그
IO.write pid, "Hello"
IO.write pid, "Hello again"
뭔가를 달성하고 싶습니다 그리고이 스크립트
#!/bin/sh
while read data
do
echo $data >> file_output.txt
done
입니다
포트 : http://elixir-lang.org/docs/stable/elixir/Port.html을 참조하십시오. 특히, 'Port.open/2'와 'Port.command/3'. – Dogbert
이것 역시 관련되어 보입니다. https://stackoverflow.com/questions/10872909/erlang-read-stdin-write-stdout – Stratus3D
@ Stratus3D stdin에 쓰려면 반대쪽을 찾고 있습니다. – LemmonMaxwell