sindresorhus / get-windows

Get metadata about the active window and open windows (title, id, bounds, owner, etc)
MIT License
783 stars 161 forks source link

Apple Silicon M1 Support - Error: spawn Unknown system error -86 #139

Closed wrgoto closed 2 years ago

wrgoto commented 2 years ago

Hey @sindresorhus,

We recently built an arm64 build of our Electron app via Electron Builder and it properly installs and boots up correctly. However, when trying to run active-win on an M1 computer, we run into the following error:

[2022-04-01 18:24:44.289] [error] Error: spawn Unknown system error -86
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at spawn (child_process.js:562:9)
    at execFile (child_process.js:246:17)
    at child_process.js:181:21
    at electron/js2c/asar_bundle.js:5:3089
    at module.exports (/Applications/Rize.app/Contents/Resources/app.asar/node_modules/@rize-io/active-win/lib/macos.js:36:25)
    at module.exports (/Applications/Rize.app/Contents/Resources/app.asar/node_modules/@rize-io/active-win/index.js:5:35)
    at Object.getActiveApp (/Applications/Rize.app/Contents/Resources/app.asar/main.js:1:60324)
    at Object.check (/Applications/Rize.app/Contents/Resources/app.asar/main.js:1:58608)
    at listOnTimeout (internal/timers.js:554:17)

If the user installs Rosetta, the issue goes away. This is on a MacBook Pro M1 Max 14" with macOS 12.3.1 installed.

A couple of notes, we use our own fork of active-win but the problem likely happens with the original seeing that the child process has an issue booting up and our macos.js file is identical.

sindresorhus commented 2 years ago

Make sure your fork is fully up to date: https://github.com/sindresorhus/active-win/commit/7ab6bfd1bc9d8455622fcef408fae744172ab5c3#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L19-R19

wrgoto commented 2 years ago

Verified that was the issue! Thanks for your time @sindresorhus.