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

compiletest: detect nodejs binary, allow override #34236

Closed
wants to merge 1 commit into from

Conversation

tari
Copy link
Contributor

@tari tari commented Jun 12, 2016

Rather than hardcoding the binary name for running asmjs tests, attempt
to detect the name that should be used; either nodejs or node. Also
add a command-line argument to manually specify what should be used,
suppressing probing.

Fixes #34188.

Rather than hardcoding the binary name for running asmjs tests, attempt
to detect the name that should be used; either `nodejs` or `node`. Also
add a command-line argument to manually specify what should be used,
suppressing probing.

Fixes rust-lang#34188.
@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

}
}
None
}
Copy link
Member

Choose a reason for hiding this comment

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

This may also be expressible as:

let path = env::var_os("PATH").unwrap_or(OsString::new());
env::split_paths(&path).flat_map(|p| {
    vec![p.join("nodejs"), p.join("node"), p.join("nodejs.exe"), p.join("node.exe")]
}).filter(|p| {
    p.exists()
}).next()

It's ok to not really optimize this much but we probably want to also handle windows as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I forgot about Windows so at least the .exe variants should be added. I also considered trying to run each instead of scanning PATH, which would free us from needing to know about a platform's executable suffix so I think that's a better solution.

Copy link
Member

Choose a reason for hiding this comment

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

Hm spawning processes here may be a bit expensive here so it may be best to just rely on file detection

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with Windows handled as well!

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

Successfully merging this pull request may close these issues.

3 participants