mafredri / zsh-async

Because your terminal should be able to perform tasks asynchronously without external tools!
MIT License
756 stars 37 forks source link

Can't call function: command not found #56

Closed tastytea closed 2 years ago

tastytea commented 2 years ago

I'm trying to get this to work:

function completed_callback() { print $@ } 
function foo() { print hello }

async_init
async_start_worker my_worker -n
async_register_callback my_worker completed_callback
async_job my_worker foo

But I always get foo 127 0.0350267887 (eval):1: command not found: foo 0 back.

zsh 5.8.1, zsh-async master branch, installed with antibody

mafredri commented 2 years ago

Could you share the output from running setopt in terminal?

Also, would you mind trying it out by putting the following in a file (e.g. test.zsh) and executing it?

#!/usr/bin/env zsh

emulate -R zsh

source async.zsh

function completed_callback() { print $@ } 
function foo() { print hello }

async_init
async_start_worker my_worker -n
async_register_callback my_worker completed_callback
async_job my_worker foo

sleep 0.1
sleep 0.1

Then:

chmod +x test.zsh
./test.zsh
tastytea commented 2 years ago

Could you share the output from running setopt in terminal?

alwaystoend
autocd
autopushd
completeinword
correctall
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
interactive
interactivecomments
longlistjobs
monitor
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle

Also, would you mind trying it out by putting the following in a file (e.g. test.zsh) and executing it? […]

That works.

tastytea commented 2 years ago

Hmm. I have the snippet from the first comment in my .zshrc. It used to fail every time. Then it worked sometimes and failed sometimes. Now it works all the time. It seems that the problem is in my Zsh configuration somewhere. Sorry for bothering you with this.