summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deno2/deno.cc12
-rw-r--r--deno2/include/deno.h6
2 files changed, 10 insertions, 8 deletions
diff --git a/deno2/deno.cc b/deno2/deno.cc
index 791c0db8e..d21e0bcea 100644
--- a/deno2/deno.cc
+++ b/deno2/deno.cc
@@ -288,16 +288,16 @@ void deno_set_flags(int* argc, char** argv) {
const char* deno_last_exception(Deno* d) { return d->last_exception.c_str(); }
-bool deno_execute(Deno* d, const char* js_filename, const char* js_source) {
+int deno_execute(Deno* d, const char* js_filename, const char* js_source) {
auto* isolate = d->isolate;
v8::Locker locker(isolate);
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
auto context = d->context.Get(d->isolate);
- return deno::Execute(context, js_filename, js_source);
+ return deno::Execute(context, js_filename, js_source) ? 1 : 0;
}
-bool deno_pub(Deno* d, const char* channel, deno_buf buf) {
+int deno_pub(Deno* d, const char* channel, deno_buf buf) {
v8::Locker locker(d->isolate);
v8::Isolate::Scope isolate_scope(d->isolate);
v8::HandleScope handle_scope(d->isolate);
@@ -310,7 +310,7 @@ bool deno_pub(Deno* d, const char* channel, deno_buf buf) {
auto sub = d->sub.Get(d->isolate);
if (sub.IsEmpty()) {
d->last_exception = "deno_sub has not been called.";
- return false;
+ return 0;
}
// TODO(ry) support zero-copy.
@@ -325,10 +325,10 @@ bool deno_pub(Deno* d, const char* channel, deno_buf buf) {
if (try_catch.HasCaught()) {
deno::HandleException(context, try_catch.Exception());
- return false;
+ return 0;
}
- return true;
+ return 1;
}
void deno_set_response(Deno* d, deno_buf buf) {
diff --git a/deno2/include/deno.h b/deno2/include/deno.h
index 72318677a..6246d1d23 100644
--- a/deno2/include/deno.h
+++ b/deno2/include/deno.h
@@ -30,11 +30,13 @@ void deno_delete(Deno* d);
// Returns false on error.
// Get error text with deno_last_exception().
-bool deno_execute(Deno* d, const char* js_filename, const char* js_source);
+// 0 = fail, 1 = success
+int deno_execute(Deno* d, const char* js_filename, const char* js_source);
// Routes message to the javascript callback set with deno_sub(). A false return
// value indicates error. Check deno_last_exception() for exception text.
-bool deno_pub(Deno* d, const char* channel, deno_buf buf);
+// 0 = fail, 1 = success
+int deno_pub(Deno* d, const char* channel, deno_buf buf);
// Call this inside a deno_sub_cb to respond synchronously to messages.
// If this is not called during the life time of a deno_sub_cb callback