The current change leaves a few questions unanswered: What should lilypond-book do if there happens to be an old .lock file around? Right now, it just sits there and does nothing which is not obvious to the user.
Also, what's the benefit of doing this? Is it worth doing in terms of runtime? https://codereview.appspot.com/555360043/diff/551490043/scripts/lilypond-book.py File scripts/lilypond-book.py (right): https://codereview.appspot.com/555360043/diff/551490043/scripts/lilypond-book.py#newcode458 scripts/lilypond-book.py:458: lock_file = os.path.join(options.lily_output_dir + ".lock") At first glance I thought this was wrong and should have two arguments to join (otherwise the call is useless). After seeing that you only mkdir lily_output_dir below, maybe you want a file $(basename lily_output_dir).lock at the parent directory? That's a bold assumption that there is no / at the end... https://codereview.appspot.com/555360043/diff/551490043/scripts/lilypond-book.py#newcode460 scripts/lilypond-book.py:460: while 1: while True https://codereview.appspot.com/555360043/diff/551490043/scripts/lilypond-book.py#newcode477 scripts/lilypond-book.py:477: os.close(lockfd) You should close the file before removing it. https://codereview.appspot.com/555360043/