Executing paths should be supported
I'd like a cross-platform way of executing local executables, e.g. under *nix I can currently:
./local/path/executable
this doesn't work under windows because of the path representation ./.
I was hoping I could run:
shx ./local/path/executable
But that doesn't seem to be supported.
Thanks! Otherwise awesome job!
@niieani Could you give an example of how to run a command under Windows?
Case 1: same directory
$ ./foo
Case 2: Subdirectory
$ path/to/dir/foo # or
$ ./path/to/dir/foo
@nfischer not sure what's the proper way under Windows, but I've found a workaround - it seems cross-env (https://github.com/kentcdodds/cross-env) makes it possible to run executables in a cross-platform way. Perhaps dissecting that package might point to a solution.
I think that's really about setting environmental variables. If you only want a cross-platform way to run commands, I think you can use path/to/binary (assuming it has one or more directories). I'm surprised that ./binary doesn't work on Windows.
This is all without the shx prefix of course.
Well yeah, cross-env normally is used for setting environmental variables, but I found the other use to be a cross-platform way to run commands. :) Indeed ./binary doesn't work on Windows. I believe .\binary does though.
Hmmm interesting. I'll investigate when I boot up my Windows machine.
We may also want to consider modifying the PATH to allow for executing binaries installed from local node module (or perhaps as an extension to shx).
@nfischer any update on this? Looks like this issue is over 6 years old. Maybe it's time to either close this issue as wouldn't do?
This feature will allow to run commands silently, which is impossible to do cross-platform.
# cmd
command > nul 2>&1
# powershell
command *> $null
# bash
command > /dev/null 2>&1
shx --silent command