Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing paths should be supported #65

Open
niieani opened this issue Jun 15, 2016 · 7 comments
Open

Executing paths should be supported #65

niieani opened this issue Jun 15, 2016 · 7 comments
Labels

Comments

@niieani
Copy link

niieani commented Jun 15, 2016

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!

@nfischer
Copy link
Member

@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 nfischer added the feat label Jun 15, 2016
@niieani
Copy link
Author

niieani commented Jun 16, 2016

@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.

@nfischer
Copy link
Member

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.

@niieani
Copy link
Author

niieani commented Jun 17, 2016

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.

@nfischer
Copy link
Member

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).

@ktalebian
Copy link

@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?

@ftoh
Copy link

ftoh commented Apr 14, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants