Search code examples
zshgnu-parallel

env_parallel:92: argument list too long: /usr/bin/parallel


I'm trying to use the solution posted here: https://stackoverflow.com/a/50497981/9355411

and have a .zshrc like:

. $(which env_parallel.zsh)

when I make any call to env_parallel, I get the following error:

env_parallel:92: argument list too long: /usr/bin/parallel


Solution

  • I take it that you run a version < 20180722 and you run it as:

    env_parallel echo ::: foo
    

    This will try to copy your full environment (all aliases, all functions, all arrays, and all variables). Unfortunately zsh uses execve to start programs, and execve typically only supports 128 KB of environment.

    So what to do? If you upgrade to 20190622 env_parallel will give this error:

    env_parallel: Error: Your environment is too big.
    env_parallel: Error: You can try 3 different approaches:
    env_parallel: Error: 1. Run 'env_parallel --session' before you set
    env_parallel: Error:    variables or define functions.
    env_parallel: Error: 2. Use --env and only mention the names to copy.
    env_parallel: Error: 3. Try running this in a clean environment once:
    env_parallel: Error:      env_parallel --record-env
    env_parallel: Error:    And then use '--env _'
    env_parallel: Error: For details see: man env_parallel
    

    So try one of those suggestions.

    --session is supported since 20180522.