Published on

Coprocess communication with coproc

Authors
  • Mehdi Akiki avatar
    Name
    Mehdi Akiki
    Twitter

Start a coprocess:

coproc myproc { some-server --interactive; }
echo "request" >&${myproc[1]}
read -r response <&${myproc[0]}

Tip: coproc is handy for talking to interactive commands without ptys.

I build and scale reliable production systems. Open to full-time and freelance work with U.S.-based teams that value ownership and execution.

Got something in mind?

Book a Discovery Call