bmsherman/haskell-matlab

Add API for stdout (engOutputBuffer)

Opened this issue · 3 comments

Currently there is no way to retrieve stdout of the MATLAB process; for this we need engOutputBuffer, and possibly some convenience APIs written atop it to make dealing with buffers less burdensome.

An alternative, possibly more appealing in certain cases anyway (and certainly appearing simpler) is the MATLAB diary, which basically tells MATLAB to log all output to a specified file - I'll explore this soon.

Confirmed that diary works well for most use cases. Using Path, a couple of example functions would be:

diaryFile :: Engine -> Path b File -> MIO ()
diaryFile e logFile = engineEval e $ "diary " <> (toFilePath logFile)

diaryOn :: Engine -> MIO ()
diaryOn e = engineEval e "diary on"

Does engOutputBuffer include stderr? What sorts of things are logged to stederr in MATLAB?