Skip to content

macOS: a Gutenberg build fills the Dock with "exec" icons, one per Electron-as-Node worker that sets its process title #518

Closed

Description

@juanmaguitar

Description

On macOS, a Gutenberg build (full build, npm run dev, a PR apply, a trunk update) fills the Dock with black icons titled exec, up to a dozen at a time, one per build worker. They come and go with the build. A Core build shows none. The macOS sibling of #497 (Windows console windows): same origin, Electron running as Node below npm, different symptom.

Pinned cause. Every node the build runs is the app's shim, which execs Contents/MacOS/WordPress Contributor Toolkit with ELECTRON_RUN_AS_NODE=1. When such a process sets process.title (libuv's darwin implementation checks the process in with LaunchServices to do it), LaunchServices registers it under the bundle's Info.plist, and the main bundle has no LSUIElement, so it is a Foreground app and the Dock shows it. npm sets its title (npm run dev appears in lsappinfo list as a Foreground entry of that binary), and Gutenberg's build workers set theirs to exec. Core's grunt sets none, which is why it never showed one.

Verified on the v1.2.0-beta.1 build (621d3d5 artifact), macOS 27:

ELECTRON_RUN_AS_NODE=1 "…/Contents/MacOS/WordPress Contributor Toolkit" -e "process.title='t'; …"
  → lsappinfo: type="Foreground"      (Dock icon)
ELECTRON_RUN_AS_NODE=1 "…/Contents/Frameworks/WordPress Contributor Toolkit Helper.app/Contents/MacOS/WordPress Contributor Toolkit Helper" -e "process.title='t'; …"
  → lsappinfo: type="UIElement"       (no Dock icon)

Without a process.title assignment neither binary registers, spawning children included, so it is the title, not the spawn.

Fix. On macOS, run Electron-as-Node through the Helper bundle, whose Info.plist carries LSUIElement, instead of the main binary. It is the same Electron (process.versions identical: node 24.18.0, electron 43.2.0). One resolver, nodeExecPath() beside nodeShim in src/node-shims.cjs (Helper path derived from process.execPath on darwin when it exists, process.execPath otherwise), used by the shims ensureNodeShimDir writes and by the runner spawn in main.js (spawn(process.execPath, [runnerPath…])), so the runners themselves stop registering too. Windows and Linux keep process.execPath. The runners set npm_node_execpath from process.execPath (install-runner.js, script-runner.js); once they run on the Helper that is already the Helper.

Step-by-step reproduction instructions

  1. macOS, Gutenberg site past the install step.
  2. Run full build, or Start build watch.

Expected: nothing new in the Dock. Actual: black exec icons appear during the transpile/bundle phases and vanish when the build ends.

Operating system

macOS 27.0 (Apple Silicon). Not applicable to Windows (#497 covers it) or Linux.

App version

v1.2.0-beta.1 and trunk at 621d3d5. Seen during the manual pass of #516. Pre-existing: the macOS shim is unchanged since #395 (v1.1.0), and Core builds never set a title.

Related

#497, #512, #251.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggutenberg-contributionsSupport Gutenberg as a contribution target (#251)

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions