bmwant / hapless

Run and manage background processes
https://bmwant.link/hapless-easily-run-and-manage-background-processes/
124 stars 5 forks source link

Hapless in zsh, doesn't inherit shell #28

Open Scream85 opened 10 months ago

Scream85 commented 10 months ago

I have a zsh function that I store in .zshrc, my shell is zsh. When I try to run my function, I get the following error: /bin/sh: somezshfunction: command not found

$ hap clean
🧲 Deleted 4 finished haps

$ hap status
🧲 No haps are currently running

$ hap run 'somezshfunction'
🧲 Launching hap ⚡️1 (hap-tp9g3w)

$ hap status
┏━━━━┯━━━━━━━━━━━━┯━━━━━━━┯━━━━━━━━━━┯━━━━━┯━━━━━━━━━━┓
┃ #  │ Name       │ PID   │ Status   │  RC │  Runtime ┃
┠────┼────────────┼───────┼──────────┼─────┼──────────┨
┃ 1  │ hap-tp9g3w │ 66805 │ • failed │ 127 │ a moment ┃
┗━━━━┷━━━━━━━━━━━━┷━━━━━━━┷━━━━━━━━━━┷━━━━━┷━━━━━━━━━━┛

$ hap logs --stderr hap-tp9g3w
/bin/sh: somezshfunction: command not found

$ set | grep -i shell
SHELL=/bin/zsh

I tried to include it in the command to use zsh, but same error:

 $ hap logs --stderr hap-213nam
/bin/sh: zsh -c 'somezshfunction': command not found

Is there a way to make this work or set hapless to use zsh?

bmwant commented 10 months ago

@Scream85 fix is in place, will release a new version of the package soon