1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix: empty process.platform with __runtime_js_sources (#24005)

We use the `target` property of the snapshot options to derive
`process.platform` and `process.arch` from. This value had an incorrect
format when compiled with `__runtime_js_sources` enabled. This PR fixes
that so that `process.platform` holds the proper value.

Fixes https://github.com/denoland/deno/issues/23164
This commit is contained in:
Marvin Hagemeister 2024-05-28 13:20:19 +02:00 committed by GitHub
parent a0ddf73058
commit 1f913f2eb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,11 +42,20 @@ pub struct SnapshotOptions {
impl Default for SnapshotOptions {
fn default() -> Self {
let arch = std::env::consts::ARCH;
let platform = std::env::consts::OS;
let target = match platform {
"macos" => format!("{}-apple-darwin", arch),
"linux" => format!("{}-unknown-linux-gnu", arch),
"windows" => format!("{}-pc-windows-msvc", arch),
rest => format!("{}-{}", arch, rest),
};
Self {
deno_version: "dev".to_owned(),
ts_version: "n/a".to_owned(),
v8_version: deno_core::v8_version(),
target: std::env::consts::ARCH.to_owned(),
target,
}
}
}