pvolok / mprocs

Run multiple commands in parallel
MIT License
1.55k stars 53 forks source link

Bash aliases #38

Open diego-rapoport opened 2 years ago

diego-rapoport commented 2 years ago

When I try to run a bash alias it just can't find it. Is there a way to configure it or it has to be implemented? Could be an interesting feature.

psibi commented 2 years ago

Do you face the issue if you use shell. Eg:

procs:
    my-cmd:
       shell: "myalias"
diego-rapoport commented 2 years ago

Yes I do. My shell is configured to be bash, not sh as I saw it tries to run when I use cmd.

pvolok commented 2 years ago

I don't really know a good way to run bash with a command and load the default config before that command. I tried calling "zsh -c my-alias", but that doesn't have aliases from my .zshrc. Maybe bash has some arguments to load default config.

diego-rapoport commented 2 years ago

So, what I've discovered is that my env $SHELL is set as bash but mprocs is using sh. The output of echo $0 is indeed sh as mprocs output.

diego-rapoport commented 2 years ago

So I've managed to make it work using bash -i -c my_alias in shell from config, but wish I shouldn't.

fstamour commented 2 years ago

So I've managed to make it work using bash -i -c my_alias in shell from config, but wish I shouldn't.

This is the only reasonable way to achieve that. Aliases don't exists outside bash and can't be called outside of bash. The -i is also necessary because, I presume, your aliases are defined in your bashrc.