rust-lang / rust-playground

The Rust Playground
https://play.rust-lang.org/
Apache License 2.0
1.24k stars 206 forks source link

Backend server does not run on Windows #913

Open miaomiao1992 opened 1 year ago

miaomiao1992 commented 1 year ago

it seems only linux can deploy the server.

error[E0433]: failed to resolve: could not find `unix` in `os`
 --> src\sandbox.rs:8:9
  |
8 |     os::unix::fs::PermissionsExt,
  |         ^^^^ could not find `unix` in `os`

error[E0433]: failed to resolve: could not find `unix` in `os`
   --> src\sandbox.rs:624:18
    |
624 |     use std::os::unix::process::ExitStatusExt;
    |                  ^^^^ could not find `unix` in `os`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `ui` due to 2 previous errors
shepmaster commented 1 year ago

Yes, the current implementation expects to communicate with the Docker instance in part by writing files to disk from the server and then reading them inside the container (and vice-versa for the result). Experimentation showed that we needed to apply some permissions changes for that to work.

Work is progressing on a re-implementation where we will likely only communicate to the Docker container via stdin/out, which should magically fix this problem.

In the short term, try commenting that code out and seeing how running it works. It may not be needed at all on Windows, or it may need some alternative. Happy to review a PR with the results.

shepmaster commented 1 year ago

The ExitStatusExt is trickier. The container definitely runs Linux commands and we get the Linux exit code. We smuggle that through the Docker layer and re-attach it to propagate upwards. It's possible we may only need a simple success/failure indicator instead of the full-blown exit code though.

Ditto for experimentation and future PR.