Skip to content

Commit

Permalink
fix: empty process.platform with __runtime_js_sources (#24005)
Browse files Browse the repository at this point in the history
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 #23164
  • Loading branch information
marvinhagemeister committed May 28, 2024
1 parent a0ddf73 commit 1f913f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion runtime/ops/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
Expand Down

0 comments on commit 1f913f2

Please sign in to comment.