spread icon indicating copy to clipboard operation
spread copied to clipboard

feat: flag to select shell to use in adhoc scripts

Open bepri opened this issue 1 year ago • 1 comments

Currently, spread assumes that the default shell is Bourne-like (perhaps specifically bash?) and runs adhoc scripts with whatever that default shell currently is. I recently changed my default shell from zsh to fish, and this broke a spread test for me.

Example:

multipass:
  type: adhoc
  allocate: |
    # something that works in zsh, but not fish
    COUNT="1"; echo $(($COUNT + 1))
    # the fish equivalent for convenience
    # set COUNT "1"; echo $(math $COUNT + 1)

Running a spread task with this config in zsh will work, but if your default shell is fish then you'll get fish errors:

++ COUNT="1"; echo $(($COUNT + 1))
fish: Unsupported use of '='. In fish, please use 'set COUNT "1"'.
COUNT="1"; echo $(($COUNT + 1))
^~~~~~~~^

I think it would be useful to have another parameter that could be set on these scripts:

multipass:
  type: adhoc
  shell: /usr/bin/bash
  allocate: |
    ...

bepri avatar Jan 09 '25 18:01 bepri