screen.capture crashes node process on Windows under certain conditions
lewisl9029 opened this issue · 0 comments
lewisl9029 commented
Version
2.1.1
Short overview
I've been exploring using nut.js (and more recently the libnut library directly) to control a headless Windows machine monitored through RDP (Using the official Remote Desktop app).
The setup generally worked fine, but I noticed the node process ends up consistently crashing as soon as I disconnect the RDP session. (the script keeps calling screen.capture on a 1 second interval)
Detailed error description
Dug into it a bit this weekend and found that the crash was due to this null returning branch in copyMMBitmapFromDisplayInRect being unhandled downstream.
See #54 for my proposed fix.
Steps to reproduce error
- Create a node script that calls
setInterval(() => libnut.screen.capture(), 1000) - Run it on a windows machine through RDP
- Exit the RDP session
- Reconnect to the machine
Expected:
Script is still running
Actual:
Script crashes