Merge pull request #2726 from atom/fix-stdout

Fix exception when accessing process.stdout
This commit is contained in:
Cheng Zhao 2015-09-07 23:02:56 +08:00
commit 564b74b19c
4 changed files with 17 additions and 2 deletions

View file

@ -38,7 +38,9 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
#else #else
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif // defined(DEBUG) #endif // defined(DEBUG)
#endif // defined(OS_WIN) #else // defined(OS_WIN)
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
#endif // !defined(OS_WIN)
logging::InitLogging(settings); logging::InitLogging(settings);
// Logging with pid and timestamp. // Logging with pid and timestamp.

View file

@ -133,3 +133,11 @@ describe 'node feature', ->
b = new Buffer(p.innerText) b = new Buffer(p.innerText)
assert.equal b.toString(), 'Jøhänñéß' assert.equal b.toString(), 'Jøhänñéß'
assert.equal Buffer.byteLength(p.innerText), 13 assert.equal Buffer.byteLength(p.innerText), 13
describe 'process.stdout', ->
it 'should not throw exception', ->
process.stdout
# Not reliable on some machines
xit 'should have isTTY defined', ->
assert.equal typeof(process.stdout.isTTY), 'boolean'

View file

@ -10,6 +10,11 @@ process.port = 0; // will be used by crash-reporter spec.
app.commandLine.appendSwitch('js-flags', '--expose_gc'); app.commandLine.appendSwitch('js-flags', '--expose_gc');
app.commandLine.appendSwitch('ignore-certificate-errors'); app.commandLine.appendSwitch('ignore-certificate-errors');
// Accessing stdout in the main process will result in the process.stdout
// throwing UnknownSystemError in renderer process sometimes. This line makes
// sure we can reproduce it in renderer process.
process.stdout;
ipc.on('message', function(event, arg) { ipc.on('message', function(event, arg) {
event.sender.send('message', arg); event.sender.send('message', arg);
}); });

2
vendor/node vendored

@ -1 +1 @@
Subproject commit c8962e460f3bf03d405489a8380a5571730f5f8d Subproject commit 9da7dd871c313d318bc1447a83ba3c7618bbbc18