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

[2.0] Jack-in command quoting fails on some Windows setups #195

Closed
PEZ opened this issue May 30, 2019 · 16 comments
Closed

[2.0] Jack-in command quoting fails on some Windows setups #195

PEZ opened this issue May 30, 2019 · 16 comments
Labels
help wanted Extra attention is needed jack-in

Comments

@PEZ
Copy link
Collaborator

PEZ commented May 30, 2019

Placing this here for Windows people to fill in more details.

@PEZ PEZ added 2.0 help wanted Extra attention is needed jack-in labels May 30, 2019
@kstehn
Copy link
Contributor

kstehn commented Jun 1, 2019

So what i could gather is that the jack-in execute the same command that is described in the wiki.
lein update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :dependencies conj "[cider/piggieback \"0.4.1\"]" -- update-in :dependencies conj "[figwheel-sidecar \"0.5.19-SNAPSHOT\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.piggieback/wrap-cljs-repl\"]" -- repl

When i execute this in the powershell this is the result:
java.lang.RuntimeException: Unsupported escape character: \] at clojure.lang.Util.runtimeException (Util.java:221) clojure.lang.LispReader$StringReader.invoke (LispReader.java:607) clojure.lang.LispReader.read (LispReader.java:285) clojure.lang.LispReader.readDelimitedList (LispReader.java:1398) clojure.lang.LispReader$VectorReader.invoke (LispReader.java:1347) clojure.lang.LispReader.read (LispReader.java:285) clojure.lang.LispReader.read (LispReader.java:216) clojure.lang.LispReader.read (LispReader.java:205) clojure.lang.RT.readString (RT.java:1874) clojure.lang.RT.readString (RT.java:1869) clojure.core$read_string.invokeStatic (core.clj:3815) clojure.core$read_string.invoke (core.clj:3805) clojure.core$mapv$fn__8430.invoke (core.clj:6912) clojure.core.protocols$fn__8144.invokeStatic (protocols.clj:168) clojure.core.protocols/fn (protocols.clj:124) clojure.core.protocols$fn__8099$G__8094__8108.invoke (protocols.clj:19) clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31) clojure.core.protocols$fn__8131.invokeStatic (protocols.clj:75) clojure.core.protocols/fn (protocols.clj:75) clojure.core.protocols$fn__8073$G__8068__8086.invoke (protocols.clj:13) clojure.core$reduce.invokeStatic (core.clj:6828) clojure.core$mapv.invokeStatic (core.clj:6903) clojure.core$mapv.invoke (core.clj:6903) leiningen.update_in$parse_args.invokeStatic (update_in.clj:13)

But when i change the command like this:
lein update-in :dependencies conj '[nrepl \"0.6.0\"]' -- update-in :dependencies conj '[cider/piggieback \"0.4.1\"]' -- update-in :dependencies conj '[figwheel-sidecar \"0.5.18\"]' -- update-in :plugins conj '[cider/cider-nrepl \"0.21.1\"]' -- update-in '[:repl-options :nrepl-middleware]' conj '[\"cider.nrepl/cider-middleware\"]' -- update-in '[:repl-options :nrepl-middleware]' conj '[\"cider.piggieback/wrap-cljs-repl\"]' -- repl
It works then. The only thing i changed was using single-quotes instead of double.

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

Thanks. Do single quotes work in the regular cmd.exe or does it need to be different between it and PowerShell?

@kstehn
Copy link
Contributor

kstehn commented Jun 1, 2019

No there i get the java.lang.RuntimeException: EOF while reading Exception.

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

Hmm, so how many windows scenarios are there?

@kstehn
Copy link
Contributor

kstehn commented Jun 1, 2019

4 i would say:

  1. CMD
  2. Powershell
  3. Linux Subsystem Bash
  4. Git bash

For 4 and 1 you can use double quotes. For 3 i have no idea but would guess double quote works there too. Only exception seems to be powershell.

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

So, the EOF while reading only happens if you use single quotes there?

3 is the same as WSL?

@kstehn
Copy link
Contributor

kstehn commented Jun 1, 2019

Yes to both :).

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

What determines if the jack-in is performed by one or the other of these? Are there vscode settings for this?

I am trying to figure out how to tell what quoting to use.

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

Alternatively, how to instruct the user to start Calva for it to work.

@kstehn
Copy link
Contributor

kstehn commented Jun 1, 2019

This is the setting: terminal.integrated.shell.windows
Here the doc from vs-code.
https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration

@PEZ
Copy link
Collaborator Author

PEZ commented Jun 1, 2019

So, if you manipulate that setting the jack-in task is affected?

PEZ added a commit that referenced this issue Jun 1, 2019
@bpringe
Copy link
Member

bpringe commented Jun 5, 2019

Hi. When I try to use the jack-in feature on Windows 10, I'm getting the following error. I'm not sure if this is related, but it looks like it may be.

> Executing task: C:\Users\MyUserName\bin\lein.bat update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl :headless <

/d : The term '/d' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ /d /c C:\Users\MyUserName\bin\lein.bat update-in :dependencies conj [nre ...
+ ~~
    + CategoryInfo          : ObjectNotFound: (/d:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

@bpringe
Copy link
Member

bpringe commented Jun 5, 2019

Update: Using single quotes worked for me as well.

@bpringe
Copy link
Member

bpringe commented Jun 6, 2019

I spent some time trying to come up with a format that would work at least in both powershell and cmd, and unfortunately could not get anything to work. So it seems the best method would be, as stated above, read the terminal environment and output the appropriate command.

@felixlinker
Copy link

I'm also using Windows and encountered the EOF issue. Here's the full log:

> Executing task: C:\Users\felix\bin\cmd\lein.bat update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl :headless <

java.lang.RuntimeException: EOF while reading

Interestingly, if i paste the upper command into cmd, it works fine. It I paste it into the powershell, I get a different error:

PS C:\Users\felix\git\event-data> C:\Users\felix\bin\cmd\lein.bat update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl :headless
java.lang.RuntimeException: Unsupported escape character: \]

This would indicate to me that it is a problem with the vs-code task runner and not the shell itself. The integrated shell that I'm using is the power shell. I hope, that added something useful for you.

PS: For brevity and because I don't think it's, I omitted the full stack trace. If you're interested in the full stack trace, just give me a shoutout :)

@bpringe
Copy link
Member

bpringe commented Jun 6, 2019

@felixlinker It is an issue with the way quoting works in Powershell, mostly. A workaround is to set your default shell in VSCode to cmd. Then the jack-in command should work.

The command will work in powershell if you replace the double quotes on the outside to single quotes (leave the escaped ones as double quotes). Something like this might work in powershell for you (if I didn't make a typo):

C:\Users\felix\bin\cmd\lein.bat update-in :dependencies conj '[nrepl \"0.6.0\"]' -- update-in :plugins conj '[cider/cider-nrepl \"0.21.1\"]' -- update-in '[:repl-options :nrepl-middleware]' conj '[\"cider.nrepl/cider-middleware\"]' -- repl :headless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed jack-in
Projects
None yet
Development

No branches or pull requests

4 participants