From ca9eb718fbf2cd2c60c7aeb3ca33413e17fcbbf0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 18 Jul 2013 23:18:50 +0200 Subject: src, lib: update after internal api change Libuv now returns errors directly. Make everything in src/ and lib/ follow suit. The changes to lib/ are not strictly necessary but they remove the need for the abominations that are process._errno and node::SetErrno(). --- src/process_wrap.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/process_wrap.cc') diff --git a/src/process_wrap.cc b/src/process_wrap.cc index dac6f2955e..5044c124e8 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -217,12 +217,9 @@ class ProcessWrap : public HandleWrap { options.flags |= UV_PROCESS_DETACHED; } - int r = uv_spawn(uv_default_loop(), &wrap->process_, options); + int err = uv_spawn(uv_default_loop(), &wrap->process_, options); - if (r) { - SetErrno(uv_last_error(uv_default_loop())); - } - else { + if (err == 0) { assert(wrap->process_.data == wrap); wrap->object()->Set(String::New("pid"), Integer::New(wrap->process_.pid, node_isolate)); @@ -240,7 +237,7 @@ class ProcessWrap : public HandleWrap { delete[] options.stdio; - args.GetReturnValue().Set(r); + args.GetReturnValue().Set(err); } static void Kill(const FunctionCallbackInfo& args) { @@ -248,9 +245,8 @@ class ProcessWrap : public HandleWrap { UNWRAP(ProcessWrap) int signal = args[0]->Int32Value(); - int r = uv_process_kill(&wrap->process_, signal); - if (r) SetErrno(uv_last_error(uv_default_loop())); - args.GetReturnValue().Set(r); + int err = uv_process_kill(&wrap->process_, signal); + args.GetReturnValue().Set(err); } static void OnExit(uv_process_t* handle, int exit_status, int term_signal) { @@ -260,15 +256,11 @@ class ProcessWrap : public HandleWrap { assert(wrap); assert(&wrap->process_ == handle); - Local argv[2] = { + Local argv[] = { Integer::New(exit_status, node_isolate), String::New(signo_string(term_signal)) }; - if (exit_status == -1) { - SetErrno(uv_last_error(uv_default_loop())); - } - if (onexit_sym.IsEmpty()) { onexit_sym = String::New("onexit"); } -- cgit v1.2.3