Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Annoyingly, the flush kwarg for the print_function does not exist in …
Browse files Browse the repository at this point in the history
…Python 2...
  • Loading branch information
embray committed Oct 25, 2017
1 parent e960c8a commit 6e3333d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/bin/sage-flock
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ command on some systems).
# to race conditions. This script runs pip under a lock. For details, see
# https://trac.sagemath.org/ticket/21672

from __future__ import print_function


import argparse
import fcntl
import os
Expand Down Expand Up @@ -83,11 +80,12 @@ def main(argv=None):
else:
kind = "exclusive"

print("Waiting for {0} lock to run {1} ... ".format(
kind, ' '.join(pipes.quote(arg) for arg in command)), end='',
file=sys.stderr, flush=True)
sys.stderr.write("Waiting for {0} lock to run {1} ... ".format(
kind, ' '.join(pipes.quote(arg) for arg in command)))
sys.stderr.flush()
fcntl.flock(lock, locktype)
print("ok", file=sys.stderr, flush=True)
sys.stderr.write("ok\n")
sys.stderr.flush()

os.execvp(command[0], command)

Expand Down

0 comments on commit 6e3333d

Please sign in to comment.