sublimelsp / LSP-rust-analyzer

Convenience package for rust-analyzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run button is not working on Windows

lufog opened this issue · comments

Run button image, opens new Terminus tab with this error message:

error: couldn't determine self executable name process is terminated with return code 1.

Sublime Text 4 build 4121
LSP v1.12.1
LSP-rust-analyzer v1.0.1
Terminus v0.3.23

Works fine here. This sounds like something Cargo-specific.

@rwols, all cargo actions from "Build With..." works fine. Could this be happening because I am using CARGO_HOME and RUSTUP_HOME environment variables, to redefine default locations for .cargo and .rustup folders?


upd:
Nope, .cargo and .rustup symlinks in user folder don't fixed the problem.


upd2:
I don't know Python, but I tried to investigate this. So I modified plugin.py and put in open_runnables_in_terminus func

print(terminus_args)

before

window.run_command("terminus_open", terminus_args)

To see if terminus_args valid. What I get:

{'title': 'run create-window', 'auto_close': False, 'cwd': 'E:\\Programming\\Windows.Education.Rust\\com.microsoft.windows-samples-rs\\create_window', 'cmd': ['cargo', 'run', '--package', 'create-window', '--bin', 'create-window']}

If I manually open the Terminus tab and paste the same thing into it, it works:
image

But if I just press the run button, I get:
image

To exclude all possible errors from my side, I decided to check everything in a virtual machine with a clean operating system. What I did, step by step:

  • installed Rust via rustup-init.exe with default parameters;
    image
  • downloaded portable Sublime Text 4 Build 4121 for Windows;
  • installed LSP, LSP-rust-analizer, Terminus packages;
    image
  • created hello_world with cargo new;
  • added hellow_world folder to editor via Project -> Add folder to project;
  • pressed Run button.

And after all, I get the same error:
image

Hey so sorry about that , so do the args the LSP sends to terminus work fine? Like when run. Based on this I'm not sure exactly whats happening. Does Terminus work okay as well?

I am encountering the same problem, is anybody able to solve this on windows 10?

This seems like a Terminus issue, this aa.sublime-build illustrates it (add this file to your sublime user folder and run a build with: aa command on any file):

{
"cmd"   	: ["cargo"]            	, // this works
// "cmd"	: ["cargo","--version"]	, // this fails with couldn't determine self executable name
"target"	: "terminus_exec",
}

Commenting out terminus_exec target make both commands work (so does using exec as a target)

There is this exact issue opened randy3k/Terminus#310, though no solutions there either

Found the solution — randy3k/Terminus#368 depends on a very old and buggy winpty, if you manually use the updated pypi versions of Terminus deps (in your Data\Lib\python38 as pypi has no 3.3 versions and some deps have a min py version above 3.3) and also install Terminus manually without package control (so that it doesn't auto-install those dependencies), then the Run button works!

commented

Found the solution — randy3k/Terminus#368 depends on a very old and buggy winpty, if you manually use the updated pypi versions of Terminus deps (in your Data\Lib\python38 as pypi has no 3.3 versions and some deps have a min py version above 3.3) and also install Terminus manually without package control (so that it doesn't auto-install those dependencies), then the Run button works!

@eugenesvk Can you help to provide more detailed guidance on how you performed to make this work? That can help a lot.