Cannot seem to run command from .zshrc
maniator opened this issue · 7 comments
I have an alias in my zshrc and loop seems to fail to call it.
➜ repos git:(master) loop merg
fonts:
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn merg ENOENT
at exports._errnoException (util.js:1007:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (node.js:348:7)
at startup (node.js:140:9)
at node.js:463:3
fonts exited with error: Error: Command failed: "/usr/local/lib/node_modules/loop-things/node_modules/.bin/cross-env" merg
Yep. #7
The subshell being spawned at https://github.com/mateodelnorte/meta-exec/blob/master/lib/exec.js#L22 doesn't know what your shell is. Now, we can pass it a shell parameter but that will break windows. Best thing to do may be to ensure we're not running on windows then attempt to load aliases matching the current shell.
It may be possible to use cp.exec to fire the alias command using the current shell in some other way. I'd be happy to get some experimentation help on that.
@mateodelnorte might just be a quick hack to do http://stackoverflow.com/a/8684009/561731 before we pull in current shell just to check for windows (and then could deal with windows aliases later?)
Yea, that's what I'm saying. So, we just have to check to see if we're `process.platform === 'win32'.
Like to make a PR on meta-exec for this?
My bet is if you refactor the options here to a param, use the above in an if statement to optionally set options.shell = process.env.shell
, it will magically work for the whole loop & meta stack.
I might be able to in a couple days
👍
So, I've started some work on this. The problem here is that even if I have access to the appropriate shell, there are a number of files that may need to be sourced in order to get your correct aliases. In addition to that, bash and zsh won't expand aliases using the alias
command unless the terminal is interactive. :-\
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.