LSP-rust-analyzer icon indicating copy to clipboard operation
LSP-rust-analyzer copied to clipboard

Run button is not working on Windows

Open lufog opened this issue 3 years ago • 10 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

lufog avatar Oct 27 '21 21:10 lufog

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

rwols avatar Oct 28 '21 19:10 rwols

@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

lufog avatar Oct 28 '21 20:10 lufog

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

lufog avatar Oct 29 '21 20:10 lufog

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?

daggy1234 avatar Nov 29 '21 19:11 daggy1234

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

ShabbirHasan1 avatar May 10 '22 16:05 ShabbirHasan1

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 https://github.com/randy3k/Terminus/issues/310, though no solutions there either

eugenesvk avatar Jul 26 '22 06:07 eugenesvk

Found the solution — https://github.com/randy3k/Terminus/issues/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 avatar Jul 27 '22 09:07 eugenesvk

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.

TakiGuan avatar Jul 14 '23 07:07 TakiGuan

maybe try this (or this fork with vendored dependencies seems to also work https://github.com/eugenesvk/Terminus/tree/vendor38 by installing all deps locally with the package)

  • install Terminus, extract it with PackageResourceViewer (or install from github locally)
  • remove dependencies.json file from Terminus' root to not auto-install deps
  • add .python-version file with 3.8 to Terminus' root to load in the 3.8 plugin host
  • extract/copy 3 python packages pyte,wcwidth ,pywinpty (3.8 version for pywinpty, others work in any) to the Data\Lib\python38 folder of your sublime text install (I think I just installed packages with pip and copied them or maybe manually downloaded and extracted .whl distributions, don't remember)

eugenesvk avatar Sep 10 '23 20:09 eugenesvk

I'm having this problem now, is there a solution?

jeefs avatar Sep 21 '23 02:09 jeefs