Describe the bug
ts-node-dev test/test_pyperclip.ts
I found that the process is stuck. I'm not sure if it's a problem with the implementation of pyperclip.copy itself in the linux system or a problem with the implementation of python-shell itself (such as using clipping or buffer conflicts, etc.
What I can be sure of is that pyperclip.copy works as scheduled and it won't block the py process, but the node process just keeps waiting, which puzzles me a lot
Python code
# test_pyperclip.py
# test_pyperclip.py
import pyperclip
def main():
message = "你好"
pyperclip.copy(message)
return
if __name__ == "__main__":
main()
Javascript code
import path from 'path'
import { PythonShell } from 'python-shell'
PythonShell.run(path.resolve(__dirname, 'test_pyperclip.py'), {
pythonPath: path.resolve(__dirname, '../.venv/bin/python3'),
env: { ...process.env, DISPLAY: ':1' },
}).then(
(res) => {
console.log({ res })
},
(err) => {
console.log({ err })
}
)
Expected behavior
The code will execute to console.log({res}).
Actual behavior
Even if the py process has ended after the PythonShell.run() call, the Promise remains in the pending state
Other Information (please complete the following information):
- OS: [e.g. ubuntu:20.04 & apt-get install xclip]
- Python Version [e.g. 3.11.12]
- Node Version [e.g. v22.14.0]