mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -05:00
print string with NULL '\0' (#1428)
This commit is contained in:
parent
48e29c3c86
commit
ef840f9e06
1 changed files with 4 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue