• Karel Koci's avatar
    subprocess: fix problem with lost stdout content · 8502ac4b
    Karel Koci authored
    I originally was thinking that Lua is doing something nasty like
    duplicating original file descriptor for stdout but it turns out that
    exec was a culprit. For some reason a call to exec truncates (or at
    least removes unfinished line) from stdout. I have no idea why it
    behaves that way but adding flush just after callback (before exec)
    solves that problem and allows us to correctly use print in callback.
    The weird part is that the same thing does not happen with stderr but
    non the less I also added flush for it.