Merge pull request #86 from PR0M3TH3AN/codex/modify-runserve-to-read-onionshare-log-on-failure

Show OnionShare log path on failure
This commit is contained in:
thePR0M3TH3AN
2025-06-21 16:15:36 -04:00
committed by GitHub

View File

@@ -72,7 +72,27 @@ function runServe(retry = false) {
});
onionProc.on('close', code => {
if ((code !== 0 && code !== null) || retry) {
dialog.showErrorBox('OnionShare error', `onionshare exited with code ${code}.`);
let extra = '';
try {
const confRaw = fs.readFileSync(configPath, 'utf8');
const conf = JSON.parse(confRaw);
const logPath = path.join(
__dirname,
'..',
'..',
'host',
conf.subdomain,
'onionshare.log'
);
fs.readFileSync(logPath, 'utf8');
extra = `\nSee ${logPath} for details.`;
} catch (err) {
// ignore errors reading log
}
dialog.showErrorBox(
'OnionShare error',
`onionshare exited with code ${code}.${extra}`
);
}
if (!restarting && (code !== 0 || code === null)) {
restarting = true;