cryptoadvance / cryptoadvance/specter-desktop

Fix Windows helper shutdown ReferenceError: exec is not defined

Open Beginner friendly
#2,644 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
847
Forks
259
Avg merge
6d 18h
Merged PRs (30d)
2

Description

## Problem

Issue #2640 logs repeated Windows shutdown warnings from the Electron helper path:

```text
Specterd quit warning: ReferenceError: exec is not defined
```

In `pyinstaller/electron/src/specterd.js`, `quitSpecterd()` uses `exec(...)` on Windows, but the file imports only `spawn` from `child_process`:

```js
const { spawn } = require('child_process')
...
exec('taskkill /F /T /PID ' + specterdProcess.pid)
```

## Expected behavior

On Windows, Specter Desktop should cleanly terminate the helper `specterd.exe` process without throwing a JavaScript `ReferenceError`.

## Why this matters

The `exec is not defined` bug is likely not the direct cause of #2640's invalid `config.json`, but unclean helper shutdown makes local data corruption and stale helper-process issues more likely/harder to diagnose.

## Suggested fix

Import `exec` where it is used:

```js
const { spawn, exec } = require('child_process')
```

and add/update an Electron unit/smoke test if the project has a lightweight test path for this module.

## Context

Found while investigating #2640, where the reporter runs Windows Specter Desktop in HWI Bridge mode and the local helper exits repeatedly.

Contributor guide

Open the contributing guide

Research direction

Start in pyinstaller/electron/src/specterd.js and inspect any existing Electron unit or smoke-test path for this module. Run that test path if present, and verify the Windows quit path can call exec without a ReferenceError while terminating specterd.exe cleanly.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript
Domain
desktop
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.