私がやっていることは、/tmp/ のファイルに書き込んでから os:cmd("cat /tmp/tmp.txt | myprogram") を実行することです。もっと良い方法があるはずです。
編集: この質問は同じですが未回答ですErlang Ports: Interface with a "wc"-like program?
これは似ていますが、私がやったことよりも良いとは思わない奇妙な答えがありますhttp://erlang.2086793.n4.nabble.com/open-pipe-spawn-quot-cat-quot-how-to -close-stdin-of-cat-td2112721.html
これにも解決策はありませんhttp://erlang.2086793.n4.nabble.com/open-port-issue-td2103107.html