diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-18 23:18:50 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-20 12:09:29 +0200 |
commit | ca9eb718fbf2cd2c60c7aeb3ca33413e17fcbbf0 (patch) | |
tree | b9415d0e2f6005a651276cbc40d23196a8c02ddf /src/process_wrap.cc | |
parent | 0161ec87af3d71b10d8ce679c8a1a64358fae8dc (diff) | |
download | android-node-v8-ca9eb718fbf2cd2c60c7aeb3ca33413e17fcbbf0.tar.gz android-node-v8-ca9eb718fbf2cd2c60c7aeb3ca33413e17fcbbf0.tar.bz2 android-node-v8-ca9eb718fbf2cd2c60c7aeb3ca33413e17fcbbf0.zip |
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().
Diffstat (limited to 'src/process_wrap.cc')
-rw-r--r-- | src/process_wrap.cc | 20 |
1 files changed, 6 insertions, 14 deletions
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<Value>& 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<Value> argv[2] = { + Local<Value> 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"); } |