diff options
author | 迷渡 <justjavac@gmail.com> | 2018-12-31 03:58:23 +0800 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2018-12-30 20:58:23 +0100 |
commit | ef840f9e06f7f973f3d2c99316c979815609e000 (patch) | |
tree | 1f87f966a32f5b1c76a50b4b21a2b8cc4ffe36d3 /libdeno/binding.cc | |
parent | 48e29c3c864b7b8c08bc1ab471342131bdde3c48 (diff) |
print string with NULL '\0' (#1428)
Diffstat (limited to 'libdeno/binding.cc')
-rw-r--r-- | libdeno/binding.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libdeno/binding.cc b/libdeno/binding.cc index bb931ca1d..eb83d2363 100644 --- a/libdeno/binding.cc +++ b/libdeno/binding.cc @@ -205,9 +205,10 @@ void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { v8::String::Utf8Value str(isolate, args[0]); bool is_err = args.Length() >= 2 ? args[1]->BooleanValue(context).ToChecked() : false; - const char* cstr = ToCString(str); - auto& stream = is_err ? std::cerr : std::cout; - stream << cstr << std::endl; + FILE* file = is_err ? stderr : stdout; + fwrite(*str, sizeof(**str), str.length(), file); + fprintf(file, "\n"); + fflush(file); } v8::Local<v8::Uint8Array> ImportBuf(DenoIsolate* d, deno_buf buf) { |