Skip to content

Commit 37b98c1

Browse files
committed
pr feedback
1 parent 289546f commit 37b98c1

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/workerd/io/worker-fs.c++

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,32 +1757,30 @@ void writeStdio(jsg::Lock& js, VirtualFileSystem::Stdio type, kj::ArrayPtr<const
17571757
size_t endPos = chars.size();
17581758
if (endPos > 0 && chars[endPos - 1] == '\n') endPos--;
17591759

1760-
17611760
KJ_IF_SOME(console, js.global().get(js, "console"_kj).tryCast<jsg::JsObject>()) {
17621761
auto method = console.get(js, "log"_kj);
17631762
if (method.isFunction()) {
17641763
v8::Local<v8::Value> methodVal(method);
1765-
auto methodFunc = methodVal.As<v8::Function>();
1764+
auto methodFunc = jsg::JsFunction(methodVal.As<v8::Function>());
17661765

17671766
kj::String outputStr;
17681767
auto processStdioPrefixed = Worker::Isolate::from(js).getProcessStdioPrefixed();
17691768
if (processStdioPrefixed) {
17701769
if (endPos == 0) {
1771-
v8::Local<v8::Value> args[] = {
1772-
js.str(type == VirtualFileSystem::Stdio::OUT ? "stdout:"_kj : "stderr:"_kj)};
1773-
jsg::check(methodFunc->Call(js.v8Context(), console, 1, args));
1770+
methodFunc.call(js, console,
1771+
js.str(type == VirtualFileSystem::Stdio::OUT ? "stdout:"_kj : "stderr:"_kj));
17741772
} else {
1775-
v8::Local<v8::Value> args[] = {
1776-
js.str(type == VirtualFileSystem::Stdio::OUT ? "stdout:"_kj : "stderr:"_kj),
1777-
js.str(chars.first(endPos))};
1778-
jsg::check(methodFunc->Call(js.v8Context(), console, 2, args));
1773+
methodFunc.call(js, console,
1774+
js.str(type == VirtualFileSystem::Stdio::OUT ? "stdout:"_kj : "stderr:"_kj),
1775+
js.str(chars.first(endPos)));
17791776
}
17801777
} else {
1781-
v8::Local<v8::Value> args[] = {js.str(chars.first(endPos))};
1782-
jsg::check(methodFunc->Call(js.v8Context(), console, 1, args));
1778+
methodFunc.call(js, console, js.str(chars.first(endPos)));
17831779
}
1780+
return;
17841781
}
17851782
}
1783+
KJ_LOG(WARNING, "No console.log implementation available for stdio logging");
17861784
}
17871785

17881786
// An StdioFile is a special file implementation used to represent stdin,

0 commit comments

Comments
 (0)