We Control a process by control keys (CTRL+C,CTRL+D,CTRL+Z,...) in the Linux terminal.you can find some of them here:
and Control Characters: https://en.wikipedia.org/wiki/Control_character
I found that pressing these keys sends a signal to the terminal.for example pressing Ctrl+D sends End-of-Transmission character (EOT) and Ctrl+Z sends substitute character(What Ctrl+C sends?EOF?)
What I want to do is the same for php subprocesses.
We create a process and control it by pipes.Here is an example:
<?php
$descriptorspec = array(
0 => array("pipe", "r"),//STDIN we write to it
1 => array("pipe", "w"),//STDOUT we read output from it
2 => array("pipe", "w"));//STDERR we read error output from it
$process = proc_open("/bin/bash", $descriptorspec, $pipes);//open the process.I open bash here
$STDINVal="WhatShouldBeSentToProcessToDo(Ctrl+C,Ctrl+D,...)?";//We set input here
fwrite($pipes[0],$STDINVal);//We send input to the process by writing it to STDIN
fclose($pipes[0]);
?>
My question is How can I send control signals to the process? Thanks.