Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit dc491db

Browse files
committed
Add python debugging for failed startups
1 parent f300ceb commit dc491db

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

main.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ var start_local_server = function() {
161161
});
162162
subpy.stderr.on('data', function (buf) {
163163
console.log('[STR] stderr "%s"', String(buf));
164+
fs.appendFile(__dirname + path.sep + "python_error.log", String(buf), function(err) {
165+
if(err) {
166+
return console.log(err);
167+
}
168+
});
164169
stderr += buf;
165170
});
166171
subpy.on('error', function (err) {
@@ -173,6 +178,8 @@ var start_local_server = function() {
173178
serverRunning = false;
174179
});
175180
subpy.unref();
181+
} else {
182+
mainWindow.webContents.executeJavaScript("console.log('Unable to find OpenBazaar-Server at: '" + serverPath + "')");
176183
}
177184
if (fs.existsSync(__dirname + path.sep + '..' + path.sep + 'gpg')) {
178185
process.env.PATH = __dirname + path.sep + '..' + path.sep + 'gpg' + path.sep + 'pub' + path.sep + ';' + process.env.PATH;
@@ -563,6 +570,23 @@ app.on('ready', function() {
563570

564571
require('open')('mailto:[email protected]?subject=OpenBazaar Debug Report&body=' + body);
565572

573+
}},
574+
{label: 'View Python Error Log', type: 'normal', click: function() {
575+
var logPath = __dirname + path.sep + 'python_error.log';
576+
require('open')(logPath);
577+
}},
578+
{label: 'Send Debug Package', type: 'normal', click: function() {
579+
var body = 'OpenBazaar Debug Report\n\n';
580+
body += 'OS: ' + os.platform() + ' ' + os.release() + '\n';
581+
body += 'Architecture: ' + os.arch() + '\n';
582+
body += 'CPUs: ' + JSON.stringify(os.cpus(), null, 2) + '\n';
583+
body += 'Free Memory: ' + os.freemem() + '\n';
584+
body += 'Total Memory: ' + os.totalmem() + '\n\n';
585+
body += 'Debug Log:\n';
586+
body += serverOut;
587+
588+
require('open')('mailto:[email protected]?subject=OpenBazaar Debug Report&body=' + body);
589+
566590
}},
567591
{type: 'separator'},
568592
{

0 commit comments

Comments
 (0)