Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the location of the electron logfiles from the logger itself #1454

Merged
merged 3 commits into from
Dec 1, 2023
Merged
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
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Unreleased Changes
* Version metadata at import time is now fetched with
``importlib.metadata`` instead of ``pkg_resources``.
(`#1442 <https://github.com/natcap/invest/issues/1442>`_)
* Workbench
* Fixed a broken "Find my logfiles" button on MacOS.
https://github.com/natcap/invest/issues/1452
* Coastal Vulnerability
* Fixed a bug where the model would crash when processing a float type
bathymetry raster with no nodata value.
Expand Down
3 changes: 2 additions & 1 deletion workbench/src/main/setupGetElectronPaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import path from 'path';
import { app, ipcMain } from 'electron';

import { ipcMainChannels } from './ipcMainChannels';
import { getLogger } from './logger';

export default function setupGetElectronPaths() {
ipcMain.on(ipcMainChannels.GET_ELECTRON_PATHS, (event) => {
event.returnValue = {
resourcesPath: process.resourcesPath,
logfilePath: path.join(app.getPath('userData'), 'logs', 'main.log')
logfilePath: getLogger().transports.file.getFile().path
};
});
}
4 changes: 2 additions & 2 deletions workbench/src/main/setupInvestHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ export function setupInvestRunHandlers(investExe) {
logger.debug('invest subprocess stdio streams closed');
});

investRun.on('exit', (code) => {
investRun.on('exit', (code, signal) => {
delete runningJobs[tabID];
event.reply(`invest-exit-${tabID}`, {
code: code,
});
logger.debug(code);
logger.debug(`invest exited with code: ${code} and signal: ${signal}`);
fs.unlink(datastackPath, (err) => {
if (err) { logger.error(err); }
fs.rmdir(tempDatastackDir, (e) => {
Expand Down
1 change: 0 additions & 1 deletion workbench/src/preload/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const { ipcRenderer } = require('electron');
// using `import` for electron messes with vite and yields a bad bundle.
// `import`` is okay for local modules though

import { ipcMainChannels } from '../main/ipcMainChannels';

// Most IPC initiates in renderer and main does the listening,
Expand Down