python -c 'import os; os.execvp(\'emacs\', [\'emacs\', \'-batch\', \'-eval\', \'(progn (print "start") (princ "foo") (sit-for 5) (princ "\n"))\'])'print method puts newline at the end automatically, princ does not. The above prints "start" then foo which I can't see only after 5 seconds when the newline is printed.
stdbuf -o0 python -c 'import os; os.execvp(\'emacs\', [\'emacs\', \'-batch\', \'-eval\', \'(progn (print "start") (princ "foo") (sit-for 5) (princ "\
n"))\'])'Here the "start" is immediately followed by foo and after 5 seconds I see the newline and the program terminates.