Point here is CPU is too fast so that is why you
1) put p.waitfor() to wait the process finish running
2) Put thread.sleep(5000) to wait for the Ctrl+C to put the copied contents to clipboard.
Note: Honestly 5000 is too long 200 will do the trick but I didn't modify the code because I'm lazy.