child_process: spawn().ref() and spawn().unref() #3381
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -845,3 +845,13 @@ ChildProcess.prototype.kill = function(sig) { | |
} | ||
} | ||
}; | ||
|
||
|
||
ChildProcess.prototype.ref = function() { | ||
this._handle.ref(); | ||
}; | ||
|
||
|
||
ChildProcess.prototype.unref = function() { | ||
this._handle.unref(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,18 @@ void HandleWrap::Initialize(Handle<Object> target) { | |
} | ||
|
||
|
||
// This function is used only for process.stdout. It's put here instead of | ||
// in TTYWrap because here we have access to the Close binding. | ||
Handle<Value> HandleWrap::Ref(const Arguments& args) { | ||
HandleScope scope; | ||
|
||
UNWRAP(HandleWrap) | ||
|
||
uv_ref(wrap->handle__); | ||
wrap->unref_ = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no real need to track the unref state, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This state is used later in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hah, you're right. Guess who wrote that code, then promptly forgot about it? :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well I think that this code is a point for later rewrite anyway :) Probably, I'll make things derived HandleWraps more DRY for 0.9 |
||
|
||
return v8::Undefined(); | ||
} | ||
|
||
|
||
Handle<Value> HandleWrap::Unref(const Arguments& args) { | ||
HandleScope scope; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (this._handle) this._handle.ref();