Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

MacKeyServer EACCES #36

Open
tisonkun opened this issue Mar 3, 2024 · 6 comments
Open

MacKeyServer EACCES #36

tisonkun opened this issue Mar 3, 2024 · 6 comments

Comments

@tisonkun
Copy link

tisonkun commented Mar 3, 2024

const { GlobalKeyboardListener } = require('node-global-key-listener')
const v = new GlobalKeyboardListener()

v.addListener(function (e, down) {
    if (e.state === 'DOWN') {
      let metaKey = Object.entries(down)
        .filter(([key, value]) => value === true && key.length > 1 && !/LOCK/.test(key))
        .map(([key, value]) => key);
  
      if (e.name.length === 1) metaKey.push(e.name);
      metaKey = metaKey.join('+');
      console.log(`${metaKey}`);
    }
  })

prints

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/tison/Brittani/greptime-demo-scene/keyboard-monitor/node_modules/.pnpm/[email protected]/node_modules/node-global-key-listener/bin/MacKeyServer EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/tison/Brittani/greptime-demo-scene/keyboard-monitor/node_modules/.pnpm/[email protected]/node_modules/node-global-key-listener/bin/MacKeyServer',
  path: '/Users/tison/Brittani/greptime-demo-scene/keyboard-monitor/node_modules/.pnpm/[email protected]/node_modules/node-global-key-listener/bin/MacKeyServer',
  spawnargs: []
}

Node.js v21.6.1

Mac Ventura 13.4:

Darwin tisondeMacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:19 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6020 arm64
@sancarn
Copy link
Contributor

sancarn commented Mar 3, 2024

Can you test version 0.1.1 and see if you still get the same issue? Not sure why this would be throwing but could be because of the recent PR...

@tisonkun
Copy link
Author

tisonkun commented Mar 4, 2024

@sancarn Thanks for your suggestion! Work for me when switch to 0.1.1.

0.2.0 throws the exception above.

@tisonkun
Copy link
Author

tisonkun commented Mar 4, 2024

BTW, after switching to 0.1.1, I found a similar "bug" like moses-palmer/pynput#589:

LEFT META DOWN [kVK_Command] (down: LEFT META,true)
RIGHT META DOWN [kVK_RightCommand] (down: LEFT META,true,RIGHT META,true)
RIGHT META DOWN [kVK_RightCommand] (down: LEFT META,true,RIGHT META,true)
LEFT META UP   [kVK_Command] (down: LEFT META,false,RIGHT META,true)

I actually press and release RIGHT META with LEFT META pressed.

Since it's the same for two projects, I suspect that it's a Mac issue though ...

Code snippet:

v.addListener(function (e, down) {
  console.log(
      `${e.name} ${e.state == "DOWN" ? "DOWN" : "UP  "} [${e.rawKey._nameRaw}] (down: ${Object.entries(down)})`
  );
});

@sancarn
Copy link
Contributor

sancarn commented Mar 5, 2024

@sancarn Thanks for your suggestion! Work for me when switch to 0.1.1.

0.2.0 throws the exception above.

Hmm well that's good to know at aleast... So there may have been an issue with #31 😅 Serves me right for just committing it without testing 👀

@olan-go2
Copy link

olan-go2 commented Jun 4, 2024

Any solution to this one?

@sancarn
Copy link
Contributor

sancarn commented Jun 5, 2024

Happy to accept PRs on this. Bare in mind neither of the maintainers are paid for maintaining this library, nor do we use it anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants