From 305538097bc105abe255681bf0984280a68b380e Mon Sep 17 00:00:00 2001 From: j50n Date: Fri, 11 Feb 2022 15:36:54 -0700 Subject: [PATCH] #22 edits --- build | 14 ++++++++++---- examples/pushiterable/README.md | 13 ++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/build b/build index b202ba7..b645367 100755 --- a/build +++ b/build @@ -2,12 +2,14 @@ set -e -deno fmt -deno lint +HERE="$(realpath "$(dirname $0)")" -deno test --allow-run --reload +deno fmt "$HERE" +deno lint "$HERE" -cd ./examples/warandpeace && ( +deno test --allow-run --reload "$HERE" + +cd "$HERE/examples/warandpeace" && ( set -x time ./countwords.sh < ./warandpeace.txt.gz time ./countwords.ts < ./warandpeace.txt.gz @@ -15,4 +17,8 @@ cd ./examples/warandpeace && ( echo "a b c d" | ./countwords2.ts || true time ./countwords3.ts < ./warandpeace.txt.gz echo "a b c d" | ./countwords3.ts || true +) + +cd "$HERE/examples/pushiterable" && ( + PATH=".:$PATH" ./example-of-pushiterable.ts ) \ No newline at end of file diff --git a/examples/pushiterable/README.md b/examples/pushiterable/README.md index 90d8d6f..d31ad67 100644 --- a/examples/pushiterable/README.md +++ b/examples/pushiterable/README.md @@ -1,11 +1,14 @@ # Use `PushIterable` to Implement Workers `proc` can be used to manage persistent child processes that accept messages -from your parent process and respond back with messages of their own. This is -simlar to web workers but with fewer limitations. - -Note that this isn't limited to processes that run Deno. You could just as -easily run something like `grep` or `awk` or something written in Python. +from your parent process and respond back with messages of their own. In order +to "push" messages to a process, you need to use a +[PushIterable](../../runners/push-iterable.ts). This technique is simlar to web +workers but with fewer limitations. + +Note that this isn't limited to processes that run Deno, even though that is our +example. You could just as easily run something like `grep` or `awk` or +something written in Python as a child process that is managed this way. ## Run the Example