Skip to content

Instantly share code, notes, and snippets.

@Fuco1
Created September 1, 2018 11:56
Show Gist options
  • Save Fuco1/3ae3c9cd7afc0de44193d5723fee9a8d to your computer and use it in GitHub Desktop.
Save Fuco1/3ae3c9cd7afc0de44193d5723fee9a8d to your computer and use it in GitHub Desktop.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment