Overview
Artifact ID: | cc99da2c8d925c295c0c40018eb659fc547f6a62 |
---|---|
Ticket: | 2857ab0995828207effd6ebc4526ca88a53755f7
Introduce commandline switches to avoid user input |
User & Date: | anonymous 2011-01-05 21:55:59 |
Changes
- Appended to comment:
<hr /><i>anonymous claiming to be ikoch added on 2011-01-05 21:55:59 UTC:</i><br /> I'm still puzzling together the pieces to trace fossils output and inject the appropriate answers. Now an other problem raised its ugly head. When fossil prompts the user for input, it waits for the answer on the same line as the prompt. It doesn't add a line end terminator after the prompt. The problem is that I need to read the fossil output before I can decide what to do. I do this by registering to events which occur whenever a line has been written to stdout or stderr. Unfortunately the line isn't written completely for prompts, the line end terminator is missing. Because of this, the line is never read, the event is never fired and the answer is never sent to stdin to make fossil happy. Fossil waits forever. A minor change in user.c would make it possible to read the line. Just add a newline to the format string in the printf statement and anything should work. <pre> void prompt_user(const char *zPrompt, Blob *pIn){ char *z; char zLine[1000]; blob_zero(pIn); printf("%s\n", zPrompt); /* added a newline to terminate the line */ fflush(stdout); z = fgets(zLine, sizeof(zLine), stdin); if( z ){ strip_string(pIn, z); } } </pre> I think except for the input in the user_cmd function it doesn't really matter wether the response is entered on a new line or not and even there it is not really a problem.
- resolution changed to: "Open"