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

Fix querying emcc on windows #4248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guusw
Copy link

@guusw guusw commented Jan 23, 2025

Pretty minor change, just queries emcc.bat since emcc will not work on windows

For example this simple script will output this on windows

fn main() {
    let output = std::process::Command::new("emcc.bat").arg("-dumpversion").output().ok();
    println!("{:?}", output);
    let output1 = std::process::Command::new("emcc").arg("-dumpversion").output().ok();
    println!("{:?}", output1);
}
rustc test.rs && ./test.exe
Some(Output { status: ExitStatus(ExitStatus(0)), stdout: "3.1.74\r\n", stderr: "" })
None

@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

Comment on lines +215 to +218
#[cfg(target_os = "windows")]
let output = Command::new("emcc.bat").arg("-dumpversion").output().ok()?;

#[cfg(not(target_os = "windows"))]
Copy link
Contributor

@tgross35 tgross35 Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could you use if cfg!(target_os = "windows") { ... } here instead? cfg!(...) is slightly preferred over #[cfg(...)] where possible since it allows the code to be checked on all OSs.

Otherwise lgtm, please squash with the change.

Fyi @hoodmane.

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

Successfully merging this pull request may close these issues.

3 participants