Stdout buffering seems to have been the problem!  Reverting changes from second workaround and restoring first one.