zsh-async: Hang when `cat` is aliased to `bat`

Just come across this and I love the idea, but I’m struggling to get the example working. Given this script, based on your example:

#!/usr/bin/env zsh
source $(antibody path mafredri/zsh-async)/async.zsh
async_init

worker_try() {
  echo 1 2 3 trtying!
}

COMPLETED=0
completed_callback() {
	COMPLETED=$(( COMPLETED + 1 ))
	print $@
}

async_start_worker my_worker -n
async_register_callback my_worker completed_callback

async_job my_worker worker_try
async_job my_worker print hello
async_job my_worker sleep 0.3

while (( COMPLETED < 3 )); do
	print "Waiting..."
	sleep 0.1
done

print "Completed $COMPLETED tasks!"

I simply get Waiting... repeatedly. Pressing Ctrl-C ends it with no additional output. I’m not sure of the underlying implementation but looking in the process tree for zpty yields nothing. (When calling this script as ./test.zsh, so not sourcing.)

Am I doing something wrong?

zsh 5.8 on Arch.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

See #47 for a fix