Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max argument size of around 1000 chars #68

Open
hansbogert opened this issue Oct 13, 2023 · 2 comments
Open

Max argument size of around 1000 chars #68

hansbogert opened this issue Oct 13, 2023 · 2 comments

Comments

@hansbogert
Copy link

There seems to be a max argument size which causes zsh-async to just silently error:

function foobar()
{
  echo $1
}


source ~/.zsh-async/async.zsh
async_init

# Initialize a new worker (with notify option)
async_start_worker my_worker -n

# Create a callback function to process results
completed_callback() {
  echo $@
}

# Register callback function for the workers completed jobs
async_register_callback my_worker completed_callback

# Give the worker some tasks to perform
async_job my_worker foobar $(i=0; while [ $i -lt 1000 ]; do echo -n "1"; i=$((i+1)); done)

sleep 1

Maybe it's platform dependent, so please increase if you still see the $@ output from the callback.
If you hit the error, you will not see the $@ output in the callback.

@hansbogert
Copy link
Author

I noticed the more-zpty-fixes branch, it does not resolve the issue for me.

@hansbogert
Copy link
Author

hansbogert commented Oct 13, 2023

I found a workaround for my specific issue. My issue was that I needed to send a large environment variable value as parameter, because it can change.
My workaround for now is to recognize the environment value is changed during a callback, if so, restart the worker. The worker's environment is then the same as the main environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant