Skip to content

Commit

Permalink
Merge pull request #867 from NordicSemiconductor/fix/error_on_invokin…
Browse files Browse the repository at this point in the history
…g_nrfutil

Fix: Unhandled error on some `nrfutil` invocations
  • Loading branch information
datenreisender authored Jan 18, 2024
2 parents c34dcdb + a204ea5 commit 7872558
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@ every new version is a new major version.

- `Overlay` tooltip inner padding should be set by the content within it.

### Added

- Ability to remove the launcher window again. This is especially needed on
shutdown. Otherwise when at that time someone still tries to send IPC
messages to the launcher window, an exception is thrown.

### Fixed

- `Overlay` tooltips weren't centered due to incorrect sizing styles.
- When spawning the nrfutil process fails in certain ways, an uncaught
exception in the main process got thrown. The “certain ways” make this a bit
hard to reproduce: On macOS this happened, when the nrfutil executable did
not have the executable file mode. Usually this should not happen, because
we set that mode ourselves correctly.

## 149.0.0 - 2024-01-16

Expand Down
4 changes: 4 additions & 0 deletions ipc/infrastructure/mainToRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export const registerLauncherWindowFromMain = (window: BrowserWindow) => {
launcherWindow = window;
};

export const removeLauncherWindowFromMain = () => {
launcherWindow = undefined;
};

export const send =
<T extends (...args: never[]) => void>(channel: string) =>
(...args: Parameters<T>) =>
Expand Down
5 changes: 4 additions & 1 deletion main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
inRenderer as inRendererSerialPort,
} from '../ipc/serialPort';

export { registerLauncherWindowFromMain } from '../ipc/infrastructure/mainToRenderer';
export {
registerLauncherWindowFromMain,
removeLauncherWindowFromMain,
} from '../ipc/infrastructure/mainToRenderer';

export const appDetails = { forRenderer: forRendererAppDetails };
export const apps = { forRenderer: forRendererApps };
Expand Down
4 changes: 4 additions & 0 deletions nrfutil/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ export class NrfutilSandbox {
onStdError(data, nrfutil.pid);
});

nrfutil.on('error', err => {
reject(err);
});

nrfutil.on('close', code => {
controller?.signal.removeEventListener('abort', listener);
if (aborting) {
Expand Down

0 comments on commit 7872558

Please sign in to comment.