Skip to content

Commit d257e52

Browse files
bruunoromerolpil
authored andcommitted
Ensure stdout.write exists when printing
1 parent 012d0d2 commit d257e52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gleam_stdlib.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export function bit_array_to_string(bit_array) {
342342
}
343343

344344
export function print(string) {
345-
if (typeof process === "object") {
345+
if (typeof process === "object" && process.stdout?.write) {
346346
process.stdout.write(string); // We can write without a trailing newline
347347
} else if (typeof Deno === "object") {
348348
Deno.stdout.writeSync(new TextEncoder().encode(string)); // We can write without a trailing newline

0 commit comments

Comments
 (0)