Don't forget to quit engine when GUI dies unexpectedly
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 29 Oct 2014 21:46:59 +0000 (22:46 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 29 Oct 2014 21:46:59 +0000 (22:46 +0100)
When we get an EOF signal from the GUI pipe, meaning that the GUI
died without sending a 'quit' command, we'd better shutdown the engine
before exiting ourself.

UCI2WB.c

index 7aaad84..77b671b 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -383,7 +383,7 @@ GUI2Engine()
       nomove:\r
        fflush(toE); fflush(stdout);\r
        i = 0; while((x = getchar()) != EOF && (line[i] = x) != '\n') i++;\r
-       line[++i] = 0; if(x == EOF) { printf("# EOF\n"); exit(-1); }\r
+       line[++i] = 0; if(x == EOF) { printf("# EOF\n"); fprintf(toE, "quit\n"); exit(-1); }\r
        sscanf(line, "%s", command);\r
        if(!strcmp(command, "new")) {\r
            computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0;\r