mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
libdeno: use cstream instead of printf to write to stderr
This commit is contained in:
parent
3ddac4d86c
commit
7f29e14b2a
1 changed files with 4 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "third_party/v8/include/libplatform/libplatform.h"
|
#include "third_party/v8/include/libplatform/libplatform.h"
|
||||||
|
@ -132,7 +133,7 @@ void HandleException(v8::Local<v8::Context> context,
|
||||||
if (d != nullptr) {
|
if (d != nullptr) {
|
||||||
d->last_exception = exception_str;
|
d->last_exception = exception_str;
|
||||||
} else {
|
} else {
|
||||||
printf("Pre-Deno Exception %s\n", exception_str.c_str());
|
std::cerr << "Pre-Deno Exception " << exception_str << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,9 +160,8 @@ void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||||
bool is_err =
|
bool is_err =
|
||||||
args.Length() >= 2 ? args[1]->BooleanValue(context).ToChecked() : false;
|
args.Length() >= 2 ? args[1]->BooleanValue(context).ToChecked() : false;
|
||||||
const char* cstr = ToCString(str);
|
const char* cstr = ToCString(str);
|
||||||
auto stream = is_err ? stderr : stdout;
|
auto& stream = is_err ? std::cerr : std::cout;
|
||||||
fprintf(stream, "%s\n", cstr);
|
stream << cstr << std::endl;
|
||||||
fflush(stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static v8::Local<v8::Uint8Array> ImportBuf(v8::Isolate* isolate, deno_buf buf) {
|
static v8::Local<v8::Uint8Array> ImportBuf(v8::Isolate* isolate, deno_buf buf) {
|
||||||
|
|
Loading…
Reference in a new issue