Simple ground dataspace dump on SIGQUIT (Ctrl-\)

This commit is contained in:
Tony Garnock-Jones 2018-11-26 13:13:44 +00:00
parent 0eb9205a19
commit f837aac390
2 changed files with 9 additions and 3 deletions

View File

@ -104,6 +104,12 @@ function bootModule(mod) {
if (typeof document !== 'undefined') {
document.addEventListener("DOMContentLoaded", (e) => { g.start(); });
} else {
process.on('SIGQUIT', () => {
console.log('---------------------------------------------------------------------------');
console.log(g.index.root._debugString());
console.log('ACTORS');
g.actors.forEach((a) => console.log(' ' + a.toString()));
});
g.start();
}
}

View File

@ -279,7 +279,7 @@ Index.prototype.sendMessage = function(v) {
});
};
Node.prototype._debugString = function () {
Node.prototype._debugString = function (outerIndent) {
const pieces = [];
const inspect = require('util').inspect;
function line(indent, content) {
@ -325,8 +325,8 @@ Node.prototype._debugString = function () {
walkCache(indent, h.cachedCaptures);
line(indent, '' + h.callbacks.size + ' callback(s)');
}
line('', 'INDEX ROOT');
walkNode('\n', this);
line(outerIndent || '', 'INDEX ROOT');
walkNode(outerIndent || '\n', this);
return pieces.join('');
};