summaryrefslogtreecommitdiff
path: root/libdeno/binding.cc
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-09-28 12:55:06 -0700
committerBert Belder <bertbelder@gmail.com>2018-09-28 12:56:38 -0700
commit7f29e14b2a4aeb81f33cf3ea2a7fcf6b69436e37 (patch)
tree650ac8dd1527f27cafd19b1d38d43071a30e5a16 /libdeno/binding.cc
parent3ddac4d86ca62d350c5ef5b5c43a751fb9a2a4a1 (diff)
libdeno: use cstream instead of printf to write to stderr
Diffstat (limited to 'libdeno/binding.cc')
-rw-r--r--libdeno/binding.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/libdeno/binding.cc b/libdeno/binding.cc
index 552b4c6e5..fa9aaabf7 100644
--- a/libdeno/binding.cc
+++ b/libdeno/binding.cc
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <iostream>
#include <string>
#include "third_party/v8/include/libplatform/libplatform.h"
@@ -132,7 +133,7 @@ void HandleException(v8::Local<v8::Context> context,
if (d != nullptr) {
d->last_exception = exception_str;
} else {
- printf("Pre-Deno Exception %s\n", exception_str.c_str());
+ std::cerr << "Pre-Deno Exception " << exception_str << std::endl;
exit(1);
}
}
@@ -159,9 +160,8 @@ void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
bool is_err =
args.Length() >= 2 ? args[1]->BooleanValue(context).ToChecked() : false;
const char* cstr = ToCString(str);
- auto stream = is_err ? stderr : stdout;
- fprintf(stream, "%s\n", cstr);
- fflush(stream);
+ auto& stream = is_err ? std::cerr : std::cout;
+ stream << cstr << std::endl;
}
static v8::Local<v8::Uint8Array> ImportBuf(v8::Isolate* isolate, deno_buf buf) {