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:
parent
a0ddf73058
commit
1f913f2eb6
1 changed files with 10 additions and 1 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue