print string with NULL '\0' (#1428)

This commit is contained in:
迷渡 2018-12-31 03:58:23 +08:00 committed by Bert Belder
parent 48e29c3c86
commit ef840f9e06

View file

@ -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) {