Closed biased-badger closed 4 years ago
Issue-Label Bot is automatically applying the label bug
to this issue, with a confidence of 0.61. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
@uberpwner Thank you for reporting this!
Every published version of hasura-cli
passed end-to-end tests on both Windows 10 and Windows 2016. But only CMD
was used during the tests. That might be why this behavior was not observed.
I am not so familiar with Windows-specific behavior (help wanted
label).
So, I'd like to ask 2 things, if possible.
Theoretically, this can be either a Powershell
, node
, npm
, hasura-cli
, or Windows problem, or caused by some complex combination. To reduce possibility, if available, do you mind testing with another shell instead of CMD and Powershell (Though I don't know whether there is another kind)?
By the way, for you information, here's how hasura-cli
works (in order) on Windows.
hasura <arg>
.hasura
in $PATH
is a symlink npm
created when installed.your\global\node_modules\hasura-cli\bin\hasura
, as hasura
is specified on bin
in package.json
.your\global\node_modules\hasura-cli\bin\hasura <arg>
is given to Windows.your\global\node_modules\hasura-cli\bin\hasura
, but executes your\global\node_modules\hasura-cli\bin\hasura.exe
. (A dummy text file hasura
and hasura.exe
coexists. More detail in hasura-cli#how-does-this-work)your\global\node_modules\hasura-cli\bin\hasura.exe <arg>
And secondly, would you please delete a dummy text file your\global\node_modules\hasura-cli\bin\hasura
, and try again? (tip. execute where hasura
to track the symlink, if you don't know the path)
Here's another question.
Have you(or someone) experienced(or heard) a similar experience with Powershell
or npm
(or with something else) before?
Any guess or information that might be possibly helpful is welcome. For example, how a certain process (by hasura.exe
in this case) can spawn new "child process" of CMD, or how powershell and CMD are different when it comes to dealing with process.
I will also look into why this happens.
Thank you again, for reporting the issue!
@jjangga0214 First of all, I forgot to mention, that I have NVM v1.1.7 to switch between node versions, but I guess it's not relevant to this issue.
As for your questions, I got this results:
I have 3 different shells, CMD, Powershell, and Git Bash.
Executing where hasura
produces this output:
C:\Program Files\nodejs\hasura
C:\Program Files\nodejs\hasura.cmd
Opening this path redirects me to C:\Users\misha\AppData\Roaming\nvm\v12.13.1
, where I found 3 files: hasura (bash script), hasura.cmd (cmd script) and hasura.ps1 (powershell script).
I tryed calling them all from all shells. Here are the results:
hasura version
outputs versionhasura.cmd version
outputs versionhasura.ps1 version
opens file in notepadhasura version
opens CMD window, executes command and immediately closeshasura.cmd version
outputs versionhasura.ps1 version
opens CMD window, executes command and immediately closeshasura version
looks like is trying to execute dummy text file. Outputs
C:\Program Files\nodejs/node_modules/hasura-cli/hasura: line 1: This: command not found
C:\Program Files\nodejs/node_modules/hasura-cli/hasura: line 2: The: command not found
C:\Program Files\nodejs/node_modules/hasura-cli/hasura: line 3: So,: command not found
C:\Program Files\nodejs/node_modules/hasura-cli/hasura: line 4: and: command not found
hasura.cmd version
outputs versionhasura.ps1 version
outputs /usr/bin/env: ‘pwsh’: No such file or directory
hasura version
outputs versionhasura.cmd version
outputs versionhasura.ps1 version
opens file in notepadhasura version
now outputs versionhasura.cmd version
outputs versionhasura.ps1 version
now outputs versionhasura version
now outputs versionhasura.cmd version
outputs versionhasura.ps1 version
outputs /usr/bin/env: ‘pwsh’: No such file or directory
So it looks like removing dummy file solves this issue in all shells available to me.
No, I have never experienced or heard of such behaviour.
If you need to check more details on Windows environment - I'll be happy to help.
@uberpwner Great! This information is very helpful 👍 I'll patch and test if it then really works on Windows :) (But a PR on any issue is always welcome if anyone wants to contribute, by the way) The next release will have the patch. Thanks a lot :)
My solution for bash (in case someone still needs it, I have problems with versions 1.3.1/1.3.2):
1) find your hasura
file path
where hasura
2) Open hasura
file (not hasura.cmd
). You should see this:
"$basedir/node_modules/hasura-cli/hasura" "$@"
exit $?
3) Replace it with this:
"$(dirname "$0")/node_modules/hasura-cli/hasura" "$@"
exit $?
I am not a bash expert, so any improvement will be welcomed. Though, this works for me well, so it could help somebody else.
OS
Windows 10
Versions
hasura-cli: 1.0.0 Node: v12.13.1 npm: 6.13.4
Description
Not sure if it's a bug or normal behaviour. When running hasura from any terminal other than CMD - it opens new CMD window, executes command and immediately closes. It is not very convenient in case you want to see the output. For example, when executing
hasura migrate status
Reproduction
npm i -g hasura-cli
hasura version
from Powershell console