Open raspirin opened 9 months ago
What do you mean by can't find powershell? Are you running perseus serve
from cmd
? Normally perseus shouldn't need powershell to work.
Also what happens when you just run cargo
from the same shell?
Actually, Perseus does require Powershell! For most commands, because there can be all sorts of issues with PATH
configurations that we've had in the past (mostly legacy from v0.1.0), we run them in a shell, which, on Windows, is powershell -command "<some-command>"
. Right now, there is no validation step to ensure the shell is available in any way, though I'd never thought this would be an issue, probably because I barely understand Powershell and Windows in general.
I'd be happy to add a preflight check that makes sure we can actually run commands at all, which is probably a good idea! @raspirin what shell do you regularly use? Right now, from the sounds of things, the CLI is hardcoded to not work for you...
Well, I'm not familiar with Windows and Powershell either. I use Fish on Linux.
This weird issue happened when I tried to use Perseus on my friend's computer. We indeed used Powershell there, but even though we typed powershell
into a Powershell instance, the shell couldn't recognize the command. This is what I mean by "Couldn't find Powershell". We added the location of powershell (C:\Windows\System32\WindowsPowerShell\v1.0) into PATH and then the cli stopped complaining about "Couldn't find cargo".
Also, cargo
works just fine with that weird shell and PATH configuration.
Huh, that is weird. That sounds like a configuration-specific issue somewhere in Windows, but I've just added that pre-flight check. Try downloading the latest development version of the Perseus CLI (cargo install perseus-cli --git https://github.com/framesurge/perseus
) and see if that works. Without Powershell in your PATH
, you should get a more descriptive error.
We could certainly try getting Perseus to work without depending on a shell, but as I said, there are historical reasons for that, because v0.1.0 had all sorts of problems on Windows that were solved by using a shell.
Actually this check seems to have broken every single test, give me a moment...
Okay, I've completely removed the use of shells in the CLI for now, which seems to work well, at least locally and on CI. @raspirin can you confirm this works for you on a Windows box when you next can? Happy to cut a new release if it's all working for you. (I.e. even without Powershell in your PATH
, the CLI should now work fine as long as you have the necessary tools installed.)
Good news, the cli won't report "Couldn't find cargo" with and without powershell
in PATH
.
But I got a cli error:
Error: couldn't execute command '& 'C:\Users\rin\AppData\Local\perseus\perseus_cli\cache\tools\wasm-bindgen-0.2.88/wasm-bindgen.exe' ./dist/target_wasm/wasm32-unknown-unknown/debug/app.wasm --out-dir dist/pkg --out-name perseus_engine --target web ' (this doesn't mean it threw an error, it means it couldn't be run at all)
Caused by:
program not found
I could manually run wasm-bindgen using the location above though.
Then I added powershell
into PATH
and switched back to a crates.io version of cli, the same project worked just fine as on my Linux machine.
I notice that the wasm-bindgen path is weird. It's not a completely windows-style path. Any ideas? @arctic-hen7
Hmm, that command doesn't look right at all, let me see if tool execution is still depending on the shell somehow...
@raspirin I've created a new branch fix-314
, could you try getting the CLI from there through cargo install
? It will create a perseus_debug.log
file which lists every command the CLI actually runs, my suspicion is that something is wrong with the way we split command strings into commands and arguments on Windows. Seeing that should help me understand what's going on here.
Sure. I will try this next weekend.
Sorry for the long delay. It's been a lot last couple of months. Back to the cli problem. Somehow I can't install the patched cli from source. rustc will complain that it can't build the target. Not sure if I am doing right.
PS C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli> rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
PS C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli> cargo install --path .
Installing perseus-cli v0.4.2 (C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli)
Updating crates.io index
Compiling serde v1.0.202
Compiling thiserror v1.0.61
Compiling tokio-util v0.7.11
Compiling tokio-native-tls v0.3.1
Compiling pin-project v1.1.5
Compiling multer v2.1.0
Compiling brotlic-sys v0.2.2
Compiling futures-executor v0.3.30
Compiling clap v4.5.4
Compiling notify v5.0.0-pre.13
Compiling tokio-stream v0.1.15
Compiling brotlic v0.8.2
error[E0432]: unresolved import `winapi::shared::winerror`
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:9:21
|
9 | use winapi::shared::winerror::ERROR_OPERATION_ABORTED;
| ^^^^^^^^ could not find `winerror` in `shared`
Compiling tungstenite v0.21.0
Compiling futures v0.3.30
error[E0308]: mismatched types
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:277:29
|
277 | overlapped.hEvent = request_p;
| ----------------- ^^^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
| |
| expected due to the type of this binding
|
= note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ffi\mod.rs:183:1
note: `winapi::ctypes::c_void` is defined in crate `winapi`
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
|
38 | pub enum c_void {}
| ^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:283:13
|
281 | let ret = winbase::ReadDirectoryChangesW(
| ------------------------------ arguments to this function are incorrect
282 | handle,
283 | req_buf,
| ^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
|
= note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ffi\mod.rs:183:1
note: `winapi::ctypes::c_void` is defined in crate `winapi`
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
|
38 | pub enum c_void {}
| ^^^^^^^^^^^^^^^
note: function defined here
--> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\um\winbase.rs:2072:12
|
2072 | pub fn ReadDirectoryChangesW(
| ^^^^^^^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0308, E0432.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `notify` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `perseus-cli v0.4.2 (C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli)`, intermediate artifacts can be found at `C:\Users\rin\Downloads\perseus-fix-314\target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Maybe try with cargo install --git https://github.com/framesurge/perseus --branch fix-314 perseus-cli
? There are a few reasons why installing from within the repo might not work...
Hello. "&" seems to be a valid operator in Powershell (never used powershell, so no idea what it does, but it doesn"t throw an error), while it's not in the regular command prompt.
I tried with removing the "&" from the command string formatting, and it seems to work.
( install.rs, two lines with _"let (wb_path, wopath) = (format!" in it . )
Oh! Very greatly appreciated! I'll update the branch with this and then could you confirm the CLI works for you @raspirin?
Hi. Also note that you still depend on powershell for the function run_cmd_directly in cmd.rs .
This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:
The steps to reproduce this issue are as follows:
A minimum reproducible example is available at <>.
Tribble internal data
dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWNsaQ==