Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Fix process stdin pause #2275

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2011.12.04, Version 0.6.5 (stable)

* npm workaround Windows antivirus software (isaacs)

* Upgrade V8 to 3.6.6.11


2011.12.02, Version 0.6.4 (stable), 9170077f13e5e5475b23d1d3c2e7f69bfe139727

* doc improvements (Kyle Young, Tim Oxley, Roman Shtylman, Mathias Bynens)
Expand Down
21 changes: 20 additions & 1 deletion deps/npm/lib/utils/tar.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ function unpack_ ( tarball, unpackTarget, dMode, fMode, uid, gid, cb ) {
rm(unpackTarget, function (er) {
if (er) return cb(er)
log.verbose(unpackTarget, "rm'ed")
fs.rename(folder, unpackTarget, function (er) {

moveIntoPlace(folder, unpackTarget, function (er) {
if (er) return cb(er)
log.verbose([folder, unpackTarget], "renamed")
// curse you, nfs! It will lie and tell you that the
Expand All @@ -161,6 +162,24 @@ function unpack_ ( tarball, unpackTarget, dMode, fMode, uid, gid, cb ) {
})
}

// on Windows, A/V software can lock the directory, causing this
// to fail with an EACCES. Try again on failure, for up to 1 second.
// XXX Fix this by not unpacking into a temp directory, instead just
// renaming things on the way out of the tarball.
function moveIntoPlace (folder, unpackTarget, cb) {
var start = Date.now()
fs.rename(folder, unpackTarget, function CB (er) {
if (er
&& process.platform === "win32"
&& er.code === "EACCES"
&& Date.now() - start < 1000) {
return fs.rename(folder, unpackTarget, CB)
}
cb(er)
})
}


function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) {
if (!dMode) dMode = npm.modes.exec
if (!fMode) fMode = npm.modes.file
Expand Down
10 changes: 9 additions & 1 deletion deps/uv/src/unix/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ uv_loop_t* uv_loop_new(void) {
void uv_loop_delete(uv_loop_t* loop) {
uv_ares_destroy(loop, loop->channel);
ev_loop_destroy(loop->ev);
free(loop);

#ifndef NDEBUG
memset(loop, 0, sizeof *loop);
#endif

if (loop == default_loop_ptr)
default_loop_ptr = NULL;
else
free(loop);
}


Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/unix/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EHOSTUNREACH: return UV_EHOSTUNREACH;
case EAI_NONAME: return UV_ENOENT;
case ESRCH: return UV_ESRCH;
case ETIMEDOUT: return UV_ETIMEDOUT;
default: return UV_UNKNOWN;
}

Expand Down
38 changes: 0 additions & 38 deletions deps/v8/src/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1731,44 +1731,6 @@ void Debug::PrepareForBreakPoints() {
// functions as debugging does not work with optimized code.
if (!has_break_points_) {
Deoptimizer::DeoptimizeAll();

AssertNoAllocation no_allocation;
Builtins* builtins = isolate_->builtins();
Code* lazy_compile = builtins->builtin(Builtins::kLazyCompile);

// Find all non-optimized code functions with activation frames on
// the stack.
List<JSFunction*> active_functions(100);
for (JavaScriptFrameIterator it(isolate_); !it.done(); it.Advance()) {
JavaScriptFrame* frame = it.frame();
if (frame->function()->IsJSFunction()) {
JSFunction* function = JSFunction::cast(frame->function());
if (function->code()->kind() == Code::FUNCTION)
active_functions.Add(function);
}
}
active_functions.Sort();

// Scan the heap for all non-optimized functions which has no
// debug break slots.
HeapIterator iterator;
HeapObject* obj = NULL;
while (((obj = iterator.next()) != NULL)) {
if (obj->IsJSFunction()) {
JSFunction* function = JSFunction::cast(obj);
if (function->shared()->allows_lazy_compilation() &&
function->shared()->script()->IsScript() &&
function->code()->kind() == Code::FUNCTION &&
!function->code()->has_debug_break_slots()) {
bool has_activation =
SortedListBSearch<JSFunction*>(active_functions, function) != -1;
if (!has_activation) {
function->set_code(lazy_compile);
function->shared()->set_code(lazy_compile);
}
}
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions deps/v8/src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ class Logger {
INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*));

// Profiler's sampling interval (in milliseconds).
#if defined(ANDROID)
// Phones and tablets have processors that are much slower than desktop
// and laptop computers for which current heuristics are tuned.
static const int kSamplingIntervalMs = 5;
#else
static const int kSamplingIntervalMs = 1;
#endif

// Callback from Log, stops profiling in case of insufficient resources.
void LogFailure();
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 6
#define BUILD_NUMBER 6
#define PATCH_LEVEL 8
#define PATCH_LEVEL 11
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/test/mjsunit/mjsunit.status
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ bugs: FAIL
# Fails.
regress/regress-1119: FAIL

#############################################################################
# Fails due to r10102 which reverts precise stepping on the 3.6 branch.
debug-step-2: FAIL

##############################################################################
# Too slow in debug mode with --stress-opt
compiler/regress-stacktrace-methods: PASS, SKIP if $mode == debug
Expand Down
15 changes: 8 additions & 7 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li><a href="#download">Download</a></li>
<li><a href="https://github.com/joyent/node/wiki/ChangeLog">ChangeLog</a></li>
<li><a href="#about">About</a></li>
<li><a href="http://nodejs.org/docs/v0.6.4/api">v0.6.4 docs</a></li>
<li><a href="http://nodejs.org/docs/v0.6.5/api">v0.6.5 docs</a></li>
<br/>
<li><a href="https://github.com/joyent/node/wiki">Wiki</a></li>
<li><a href="http://blog.nodejs.org/">Blog</a></li>
Expand Down Expand Up @@ -105,14 +105,15 @@ <h2 id="video">Introduction</h2>

<h2 id="download">Download</h2>

<p>2011.12.02 v0.6.4
<p>2011.12.04 v0.6.5
<ul class="release">
<li><a href="http://nodejs.org/dist/v0.6.4/node-v0.6.4.tar.gz"><code>node-v0.6.4.tar.gz</code>
<li><a href="http://nodejs.org/dist/v0.6.5/node-v0.6.5.tar.gz"><code>node-v0.6.5.tar.gz</code>
Source code</a> (<a href="https://github.com/joyent/node/wiki/Installation">build instructions</a>)
<li><a href="http://nodejs.org/dist/v0.6.4/node-v0.6.4.msi"><code>node-v0.6.4.msi</code> Windows installer</a>
<li><a href="http://nodejs.org/dist/v0.6.4/node-v0.6.4.pkg"><code>node-v0.6.4.pkg</code> Macintosh installer</a>
<li><a href="http://nodejs.org/docs/v0.6.4/api/index.html">Documentation</a>
<li><a href="http://nodejs.org/dist/v0.6.4">Other release files
<li><a href="http://nodejs.org/dist/v0.6.5/node-v0.6.5.msi"><code>node-v0.6.5.msi</code> Windows installer</a>
<li><a href="http://nodejs.org/dist/v0.6.5/node-v0.6.5.pkg"><code>node-v0.6.5.pkg</code> Macintosh installer</a>
<li><a href="http://nodejs.org/docs/v0.6.5/api/index.html">Documentation</a>
<li><a href="https://raw.github.com/joyent/node/v0.6.5/LICENSE">License</a>
<li><a href="http://nodejs.org/dist/v0.6.5">Other release files
(like <code>.exe</code> and <code>.pdb</code>)</a>
</ul>

Expand Down
15 changes: 13 additions & 2 deletions doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<html>
<head>
<meta charset="UTF-8" />
<title>{{section}}Node.js v0.6.4 Manual &amp; Documentation</title>
<title>{{section}}Node.js v0.6.5 Manual &amp; Documentation</title>
<link rel="stylesheet" href="assets/style.css" />
<link rel="stylesheet" href="assets/sh.css" />
<link rel="canonical" href="http://nodejs.org/docs/latest/api/{{filename}}.html"/>
</head>
<body>
<div id="container">
<header>
<h1>Node.js v0.6.4 Manual &amp; Documentation</h1>
<h1>Node.js v0.6.5 Manual &amp; Documentation</h1>
<div id="gtoc">
<p><a href="index.html">Index</a> | <a href="all.html">View on single page</a></p>
</div>
Expand All @@ -21,5 +21,16 @@ <h1>Node.js v0.6.4 Manual &amp; Documentation</h1>
<script src="assets/sh_main.js"></script>
<script src="assets/sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();
} catch(err) {}</script>
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
</body>
</html>
2 changes: 1 addition & 1 deletion lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var Pipe;
function createPipe(ipc) {
// Lazy load
if (!Pipe) {
Pipe = new process.binding('pipe_wrap').Pipe;
Pipe = process.binding('pipe_wrap').Pipe;
}

return new Pipe(ipc);
Expand Down
12 changes: 12 additions & 0 deletions lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ function ReadStream(fd) {
if (!stdinHandle) stdinHandle = this._handle;

this.on('newListener', onNewListener);

this.pause();
}
inherits(ReadStream, net.Socket);
exports.ReadStream = ReadStream;
Expand Down Expand Up @@ -310,6 +312,16 @@ ReadStream.prototype._emitKey = function(s) {
}
};

ReadStream.prototype.pause = function pause() {
this._handle.unref();
net.Socket.prototype.pause.call(this);
};

ReadStream.prototype.resume = function resume() {
this._handle.ref();
net.Socket.prototype.resume.call(this);
};


function WriteStream(fd) {
if (!(this instanceof WriteStream)) return new WriteStream(fd);
Expand Down
14 changes: 14 additions & 0 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ Handle<Value> HandleWrap::Unref(const Arguments& args) {
return v8::Undefined();
}

Handle<Value> HandleWrap::Ref(const Arguments& args) {
HandleScope scope;

UNWRAP

// Calling this function twice should never happen.
assert(wrap->unref == true);

wrap->unref = false;
uv_ref(uv_default_loop());

return v8::Undefined();
}


Handle<Value> HandleWrap::Close(const Arguments& args) {
HandleScope scope;
Expand Down
1 change: 1 addition & 0 deletions src/handle_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class HandleWrap {
static void Initialize(v8::Handle<v8::Object> target);
static v8::Handle<v8::Value> Close(const v8::Arguments& args);
static v8::Handle<v8::Value> Unref(const v8::Arguments& args);
static v8::Handle<v8::Value> Ref(const v8::Arguments& args);

protected:
HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
Expand Down
6 changes: 5 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2217,8 +2217,12 @@ static void PrintHelp() {
" --vars print various compiled-in variables\n"
" --max-stack-size=val set max v8 stack size (bytes)\n"
"\n"
"Enviromental variables:\n"
"Environment variables:\n"
#ifdef _WIN32
"NODE_PATH ';'-separated list of directories\n"
#else
"NODE_PATH ':'-separated list of directories\n"
#endif
" prefixed to the module search path.\n"
"NODE_MODULE_CONTEXTS Set to 1 to load modules in their own\n"
" global contexts.\n"
Expand Down
2 changes: 1 addition & 1 deletion src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#define NODE_MAJOR_VERSION 0
#define NODE_MINOR_VERSION 6
#define NODE_PATCH_VERSION 5
#define NODE_PATCH_VERSION 6
#define NODE_VERSION_IS_RELEASE 0

#ifndef NODE_STRINGIFY
Expand Down
1 change: 1 addition & 0 deletions src/tty_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class TTYWrap : StreamWrap {

NODE_SET_PROTOTYPE_METHOD(t, "close", HandleWrap::Close);
NODE_SET_PROTOTYPE_METHOD(t, "unref", HandleWrap::Unref);
NODE_SET_PROTOTYPE_METHOD(t, "ref", HandleWrap::Ref);

NODE_SET_PROTOTYPE_METHOD(t, "readStart", StreamWrap::ReadStart);
NODE_SET_PROTOTYPE_METHOD(t, "readStop", StreamWrap::ReadStop);
Expand Down
6 changes: 3 additions & 3 deletions test/simple/test-fs-long-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var common = require('../common');
var fs = require('fs');
var path = require('path');
var assert = require('assert');

var successes = 0;

// make a path that will be at least 260 chars long.
var cwd = process.cwd();
var fileNameLen = Math.max(260 - cwd.length - 1, 1);
var fileName = new Array(fileNameLen + 1).join('x');
var fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1);
var fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x'));
var fullPath = path.resolve(fileName);

console.log({ filenameLength: fileName.length,
Expand Down