Skip to content

Fix Core binary validation and process detection#16

Merged
NamecoinGithub merged 4 commits into
Mergingfrom
copilot/fix-pr-15-major-bugs
Jul 9, 2026
Merged

Fix Core binary validation and process detection#16
NamecoinGithub merged 4 commits into
Mergingfrom
copilot/fix-pr-15-major-bugs

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown

PR #15 exposed Core launch/stop correctness bugs around outdated toolchain docs, Windows executable checks, Linux PID lookup, and configurable binary handling. This narrows the fix to Core binary validation and process management while leaving broader Electron renderer hardening for a separate migration track.

  • Toolchain requirements

    • Updated package engine metadata to Node >=22.12.0 / npm >=10.x
    • Updated README build instructions that still referenced Node 10 / npm 6
  • Core binary validation

    • Normalizes configured binary paths, including matching shell-style quotes
    • Requires configured paths to be absolute
    • Rejects missing paths, directories, and invalid path components with clearer errors
    • Preserves POSIX execute-bit validation
    • On Windows, validates the resolved target is a .exe and leaves runtime validity to spawn
  • Core process detection

    • Removes Linux -p 1 restriction
    • Reads the first matching PID correctly
    • Matches configured paths, symlink targets, and bundled binary names without substring false positives
  • Core shutdown

    • Handles “no PID found” safely instead of attempting to kill an empty PID
    • Distinguishes no-process from kill-command failure
  • Settings UI

    • Adds a file picker next to “Core Binary Path”
    • Surfaces file-picker errors through the existing error dialog

@NamecoinGithub
NamecoinGithub marked this pull request as ready for review July 9, 2026 14:13
Copilot AI review requested due to automatic review settings July 9, 2026 14:13
@NamecoinGithub
NamecoinGithub merged commit 7d24654 into Merging Jul 9, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Nexus Core binary handling by tightening validation of configured/bundled binaries and making Core process detection/shutdown more reliable across platforms, while updating documented/tooling requirements and adding a Settings UI helper for selecting an external Core binary.

Changes:

  • Hardened Core binary path normalization/validation (absolute-path requirement for overrides, clearer error reporting, Windows .exe validation, retain POSIX execute-bit checks).
  • Reworked Core PID detection to correctly parse ps output and match configured paths/realpaths/bundled names without substring false positives; made shutdown safer when no PID is found.
  • Updated toolchain requirements (README + engines) and added a “Browse” file picker for “Core Binary Path”.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/core.js Adds stronger Core binary validation, improved PID detection, and safer shutdown behavior.
src/App/Settings/Core/EmbeddedCoreSettings.tsx Adds a file-picker button to populate the Core binary path setting via IPC.
README.md Updates build instructions to current Node/npm requirements.
package.json Raises supported Node/npm versions via engines.
package-lock.json Mirrors updated engines metadata in lockfile.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +108 to +118
async function browseCoreBinary() {
let paths;
try {
paths = await ipcRenderer.invoke('show-open-dialog', {
title: __('Select Nexus Core binary'),
properties: ['openFile'],
filters:
process.platform === 'win32'
? [{ name: 'Windows executable', extensions: ['exe'] }]
: undefined,
});
Comment thread src/main/core.js
Comment on lines 201 to 205
async function getCorePID() {
const { path: coreBinaryPath, name: resolvedCoreBinaryName } =
getExecutableCoreBinary();
const status = getExecutableCoreBinary();
const { path: coreBinaryPath, name: resolvedCoreBinaryName } = status;
const modEnv = { ...process.env, Nexus_Daemon: resolvedCoreBinaryName };
let PID;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants