Skip to main content

send_message

Function send_message 

Source
pub fn send_message(pid: u32, msg: &str) -> Result<()>
Expand description

Write msg to the standard input of the process with id pid.

Useful to answer prompts such as Terminate batch job (Y/N)?.

On Windows the message is injected into the target console’s input buffer and must end with "\r\n" to be submitted. On Unix it is pushed into the process’ controlling terminal with TIOCSTI, which usually requires root (and is disabled by some kernels); use "\n" on Linux, "\r" on macOS.