shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
846 stars 63 forks source link

User defined shell functions #44

Open osheari1 opened 1 year ago

osheari1 commented 1 year ago

Prerequisites

Checking new version... You are using the latest version of rush


- [x] read the usage (rush -h) and [examples](https://github.com/shenwei356/rush#examples)

### Describe your issue
I'm trying to use rush from within a shell script with a user defined bash function, but am getting the `command not found: XYZ` error.

test.sh

!/bin/bash

run() { echo $1 }

seq 5 | rush run {}

./test.sh zsh:1: command not found: run zsh:1: command not found: run 18:01:27.372 [ERRO] wait cmd #3: run 3: exit status 127 zsh:1: command not found: run 18:01:27.372 [ERRO] wait cmd #4: run 4: exit status 127 18:01:27.373 [ERRO] wait cmd #2: run 2: exit status 127 zsh:1: command not found: run zsh:1: command not found: run 18:01:27.373 [ERRO] wait cmd #1: run 1: exit status 127 18:01:27.374 [ERRO] wait cmd #5: run 5: exit status 127

sakyb7 commented 1 year ago

Export the function or use ‘set -a’ command at the beginning of the code

mizzunet commented 1 year ago

Thanks @sakyb7. I also had to set SHELL=/bin/bash because my default shell was fish