Skip to content

reconquest/coproc.bash

Repository files navigation

coproc.bash travis

Go-routines in bash.

demo.gif

Importing

import:use github.com/reconquest/coproc

Reference

See reference at REFERENCE.md.

Usage

Creating coprocess

coproc:run bc_proc "bc"

Communicating with coprocess

Setting up file descriptors

coproc:get-stdin-fd "$bc_proc" stdin

coproc:get-stdout-fd "$bc_proc" stdout
coproc:get-stderr-fd "$bc_proc" stderr

Send line

echo "1+1" >&$stdin

Receive line

read -u $stdout result

Sending initial stdin

Also, stdin can be passed on creating coprocess:

coproc:run bc_proc "bc" <<< "1+4"

coproc:get-stdout-only "$bc_proc"  # will output 5

About

Missing parallel routines (coprocesses) in bash

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •