Skip to content

Commit 2903f00

Browse files
committed
Avoid textDecoder.decode(buffer) if unnecessary
1 parent 60c5348 commit 2903f00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/ruby_engine/cruby_wasi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def run(source)
7474
textDecoder = `new TextDecoder("utf-8")`
7575
%x{
7676
wasmFs.fs.writeSync = (fd, buffer, offset, length, position) => {
77-
const text = textDecoder.decode(buffer);
7877
if (fd == 1 || fd == 2) {
78+
const text = textDecoder.decode(buffer);
7979
#{@writer.print_to_output(`text`, "")};
8080
}
8181
return originalWriteSync(fd, buffer, offset, length, position);

0 commit comments

Comments
 (0)