I'm trying to write a Linux command line UCI interface for Stockfish. My program writes a bunch of commands to a text file and then tries to pipe them to Stockfish via the command line. My problem is, whenever I try to analyse a position, the program exits almost immediately:
position startpos moves e2e4 go movetime 5000
~$ stockfish < sf.txt Stockfish 261014 64 by Tord Romstad, Marco Costalba and Joona Kiiski info nodes 0 time 2 bestmove a7a6 ponder (none)
As you can see, the program exits in 2 ms instead of waiting for the analysis to finish. Has anyone delt with this issue before? Is there a preferred way of interfacing with Stockfish?