Skip to content

Commit ffee8fd

Browse files
committed
backport core/lib fix to 1.6. Closes #12148
1 parent c3d8def commit ffee8fd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/core/lib/errors.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import * as colors from "./external/colors.ts";
1010
import { MappedString } from "./text-types.ts";
1111
import { ErrorLocation, TidyverseError } from "./errors-types.ts";
12-
import { isWindows } from "../../deno_ral/platform.ts";
1312

1413
// tidyverse error message styling
1514
// https://style.tidyverse.org/error-messages.html
@@ -25,9 +24,19 @@ import { isWindows } from "../../deno_ral/platform.ts";
2524

2625
function platformHasNonAsciiCharacters(): boolean {
2726
try {
28-
return !isWindows;
27+
// we can't import from deno_ral directly here
28+
// because it's outside of core/lib, which
29+
// gets imported by code that runs in the browser
30+
//
31+
// Then, we need to guard against Deno being undefined
32+
// there as well
33+
return Deno.build.os !== "windows";
2934
} catch (_e) {
30-
return false;
35+
//
36+
// But if deno is undefined, we can assume that we're
37+
// running in the browser, where non-ascii characters
38+
// are supported
39+
return true;
3140
}
3241
}
3342

0 commit comments

Comments
 (0)