Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function createWritableStdioStream(fd) {
const { Writable } = require('stream');
stream = new Writable({
write(chunk, encoding, callback) {
process.lwnode._print(chunk.toString());
process.lwnode._print(chunk.toString(), this.fd);
callback();
}
});
Expand Down
15 changes: 13 additions & 2 deletions deps/node/src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ typedef int mode_t;
#include <termios.h> // tcgetattr, tcsetattr
#endif

#include "trace.h" // @lwnode

namespace node {

using v8::Array;
Expand Down Expand Up @@ -436,10 +438,19 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
}

void Logger(const FunctionCallbackInfo<Value>& args) {
CHECK(args.Length() == 1 && args[0]->IsString() &&
CHECK(args.Length() > 0 && args[0]->IsString() &&
"must be called with a single string");
Utf8Value message(args.GetIsolate(), args[0]);
FPrintF(stderr, "%s", message);

Environment* env = Environment::GetCurrent(args);

if (args.Length() > 1 && args[1]->IsInt32() &&
args[1]->Int32Value(env->context()).FromJust() == 2) {
// stderr
LWNODE_DEV_FATAL_LOG(message.ToString().c_str());
} else {
FPrintF(stderr, "%s", message);
}
}

static void InitializeProcessMethods(Local<Object> target,
Expand Down