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

Julia exited with status code 1 #13

Closed
ghyatzo opened this issue Dec 10, 2021 · 5 comments
Closed

Julia exited with status code 1 #13

ghyatzo opened this issue Dec 10, 2021 · 5 comments

Comments

@ghyatzo
Copy link
Contributor

ghyatzo commented Dec 10, 2021

Hello,

I've tried this package but it doesn't seem to work. I am on Mac Os.
I noticed that the LSP log said that julia could not find the Language Server. And suggested to run Pkg.Instantiate() to install it.

If I run the subprocess call by hand it then actually instantiates. but the subprocess call returns 0 every time. That is why i had the ready file even if it wasn't actually ready. related

After running import Pkg; Pkg.instantiate() manually the plugin now runs.

@ghyatzo
Copy link
Contributor Author

ghyatzo commented Dec 10, 2021

Run some tests, noticed the following:
If I manually run subprocess.call(["julia", "--project=\"{}\"".format("path/to/language/server/env"), "--eval", "\"import Pkg; Pkg.instantiatee()\"" ]) (notice the purposeful error of adding an extra e to instantiate()). This returns nothing and exit with returncode = 0.

While if i run the following
subprocess.call(["julia", "--project=\"{}\"".format("path/to/language/server/env"), "--eval", "import Pkg; Pkg.instantiatee()" ])
(the eval string is not wrapped in escaped quotes)
I actually get the expected error message from julia and the process returns with returncode=1 as expected.
Screenshot 2021-12-11 at 00 46 44

I don't really know what is going on here. I don't even know if it is a subprocess issue, a zsh issue (i use zsh), a julia issue or a sublime text API issue.

Edit: I remove both Manifest.toml and ready from the serverdir folder. Run Sublime Text again and this time it worked flawlessly.
I am a bit baffled. I am going to close this to avoid adding confusion.

@ghyatzo ghyatzo closed this as completed Dec 11, 2021
@jwortmann
Copy link
Member

Thanks for the report and debugging help!

It seems that the quotes around arguments which contain spaces are only required in the shell / terminal, but not when given as a list to Python's subprocess. I will remove escaped quotes and hope that it solves the issue with the wrong returncode.

This still doesn't explain why the command to instantiate would not work sometimes, though. Explicit quotes should still be allowed in the arguments, and indeed you still have the quotes within the --project="..." argument in your screenshot.

I could assume that subprocess itself will add additional quotes around the arguments as well, so we end up with end up with two quotes on each side around the import Pkg; ... expression, and instead of evaluating the command, Julia will treat it as a string and just return without doing anything. It worked the second time then, because you already had the language server package installed at that point, and the same reason is why I didn't noticed it (if that assumption is true).

I think I will also update the LanguageServer.jl to the latest commit, it looks like they had some interesting updates recently (e.g. switched the document formatting to JuliaFormatter.jl), but for whatever reason they seem to be hesitant to do actual releases/tags on GitHub. If everthing works I will make a new release for LSP-julia later or tomorrow, which will then trigger to run the Pkg.instantiate() from Python subprocess again. Then we can see whether it is fixed, or not 😉

@jwortmann
Copy link
Member

I just pushed a new version tag for this package, and it should be picked up by Package Control in a few hours. This should trigger an update of the language server when a Julia file is opened the next time.
I completely removed the LanguageServer package from my Julia installation before testing the update, and the update worked for me, so I think this bug caused by the escaped quotes should be fixed now. Thanks again for pinpointing the problem, and please don't hesitate to report back, in case anything doesn't work on your side!

@ghyatzo
Copy link
Contributor Author

ghyatzo commented Dec 12, 2021

It has been a fun afternoon! Happy it was also a useful one!

I'll attempt a new installation with the update and report back in case something is broken

@ghyatzo
Copy link
Contributor Author

ghyatzo commented Dec 13, 2021

I updated the package manually through Package Control command in the command palette (hope that this is still indicative that everything works), and it successfully installed the new committed version of LS without issues. Everything seems to work correctly now.

Cheers!

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

No branches or pull requests

2 participants