codesandbox-importers icon indicating copy to clipboard operation
codesandbox-importers copied to clipboard

Cli fails to wait for user to input token on WSL

Open unleashit opened this issue 5 years ago • 4 comments

On Windows Bash (WSL), after clicking yes to "We will open CodeSandbox" and then yes to "We will open CodeSandbox to finish the login process", it shows a link to the login but the browser doesn't load. It also doesn't work manually as the program exits before allowing the user to input a token.

The browser probably isn't launching because on WSL, windows apps must have .exe appended like chome.exe. I'm able to click on the provided link, log into Github and get a token, but unfortunately I can't input it because the program has already exited.

unleashit avatar Jul 28 '18 00:07 unleashit

Not just on WSL, just confirmed the prompt doesn't wait for the user to input the token using git bash (on Windows 10) either. Also don't see a way (at least after checking codesandbox --help) to manually save a token.

unleashit avatar Aug 05 '18 20:08 unleashit

Figured out the problem is with the opn package. It is attempting to spawn a process to cmd.exe, but on WSL it's not in the path by default (at least it wasn't for me). I added it and it now works, although on WSL they should make it use whatever the current shell is instead of hardcoding cmd.exe (assuming that would work).

unleashit avatar Oct 02 '18 01:10 unleashit

I'm not sure why this fails but I noticed that it's a node version specific issue. Node 10.15.0 - browser window not opening & token input not displayed - not exporting Node 8.15.0 - browser window opens & exporting is working

Tested on Window 10 (64bit) with nvm.

I'll check if this is an issue with opn package. Tested latest version 5.4.0 with opn-cli and it's opening the browser. I also checked the history and I don't see anything Windows or Node v10 related in opn-cli since 5.1.0

AWolf81 avatar Jan 17 '19 22:01 AWolf81

Thanks for the reply. I got it to work by adding cmd to my path within the WSL environment, but IMO opn needs to add support for WSL. Here's the issue I put up over there awhile back: https://github.com/sindresorhus/opn/issues/106.

My situation might be a bit less common since I'm stripping the Windows path that gets added by WSL in my .bashrc (due to various problems). But I don't think I'm the only one who does that and I think there's now even a built in option to do that in WSL's config.

edit: perhaps you might consider throwing an Error if opn fails. Right now it fails silently and isn't easy to debug.

unleashit avatar Jan 18 '19 00:01 unleashit