Skip to content

Commit

Permalink
Merge pull request #1454 from davemfish/bugfix/WB-1452-macos-log-loca…
Browse files Browse the repository at this point in the history
…tion

Get the location of the electron logfiles from the logger itself
  • Loading branch information
emlys authored Dec 1, 2023
2 parents 49990e0 + 12572c0 commit 9ecd48c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
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

0 comments on commit 9ecd48c

Please sign in to comment.