Trying to copy a file from linux machine to windows using pscp(ssh) in my program.
Using windows API ex: CreateProcess("pscp.exe" -scp -2 "user@hostname:'<path/>status.log'" "<path>/status.log", handle)
private key is added to pagent for authentication using ssh keys
Now if the key is refused by the server, it asks for a password,
and generally waiting for the copy process to complete as below
CloseHandle(tProcInfo.hThread);
// wait for end of process
WaitForSingleObject(tProcInfo.hProcess, INFINITE);
So when it asks for password kind of stuck there as the password prompt appears and waits for input and process never ends.
How to end pscp connection/process in this case?
Reading the result string from the pipe to identify if it is a password prompt, thinking to send Ctrl+C signal , but not sure how to do it.