- Problem with named pipes error 231 "pipe busy" when DosOpen
- Problem with cmd.exe idle state (program running or waiting for user input with prompt)
I thought that all OS-specific programming works fine now, but I still have got a problem with named pipes. When the helper program opens the named pipe, I sometimes get an error 231 (pipe busy). I cannot reproduce the problem regulary. It even occurs if I run only one instance of my program. I checked all named pipe API call returns. All works fine up to the DosOpen call. DosDisConnectNPipe returns 0 when exiting the last program session and DosCreateNPipe in the current session also returns 0. DosClose in the helper program of the previous session also returns 0. The problem does not occur when running the first session of the program after booting the computer. So it seems that the previous cmdme session did not clean up all properly. Any ideas?
Then I have got another problem. I have realized that the editor has to know whether cmd.exe is in idle state (waiting for user input) or not. Because if cmd.exe is exeuting a program and e.g. the user has to enter "Y" or "N", for example, a user input has to be sent immideately to cmd.exe. If there's a prompt and the user wants to enter a new command, the finished complete line of the new command with an ending Return character is sent and before, the user can change the input, has tab completion support and so on. I can read the prompt, but the prompt can change with the PROMPT command. A program which is executed by cmd.exe could generate a similar input. Any ideas how to query this state is appreciated. (I have got the session ID of the helper which executes cmd.exe. Perhaps I can query this state by querying the current session? Or I need a very intelligent interpretation of the proposed prompt string?)