mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-22 14:49:03 -04:00
Removed redundant is_a_terminal function and minor check fixes.
This commit is contained in:
parent
14dd0414eb
commit
66fe7e5377
3 changed files with 4 additions and 12 deletions
|
|
@ -14,7 +14,7 @@ from attic.key import key_creator
|
|||
from attic.helpers import Error, location_validator, format_time, \
|
||||
format_file_mode, ExcludePattern, exclude_path, adjust_patterns, to_localtime, \
|
||||
get_cache_dir, get_keys_dir, format_timedelta, prune_within, prune_split, \
|
||||
Manifest, remove_surrogates, is_a_terminal, update_excludes
|
||||
Manifest, remove_surrogates, update_excludes
|
||||
from attic.remote import RepositoryServer, RemoteRepository
|
||||
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
|
|||
if input('Do you want to continue? ') == 'Yes I am sure':
|
||||
break
|
||||
if args.progress is None:
|
||||
args.progress = is_a_terminal(sys.stdout) or args.verbose
|
||||
args.progress = sys.stdout.isatty() or args.verbose
|
||||
if not repository.check(progress=args.progress, repair=args.repair):
|
||||
self.exit_code = 1
|
||||
return self.exit_code
|
||||
|
|
|
|||
|
|
@ -468,15 +468,6 @@ def daemonize():
|
|||
os.dup2(fd, 2)
|
||||
|
||||
|
||||
def is_a_terminal(fd):
|
||||
"""Determine if `fd` is associated with a terminal or not
|
||||
"""
|
||||
try:
|
||||
os.ttyname(fd.fileno())
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
if sys.version < '3.3':
|
||||
# st_mtime_ns attribute only available in 3.3+
|
||||
def st_mtime_ns(st):
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class Repository(object):
|
|||
"""{} is not a valid repository"""
|
||||
|
||||
class CheckNeeded(Error):
|
||||
'''Inconsistency detected. Please "run attic check {}"'''
|
||||
'''Inconsistency detected. Please run "attic check {}"'''
|
||||
|
||||
|
||||
def __init__(self, path, create=False):
|
||||
|
|
@ -199,6 +199,7 @@ class Repository(object):
|
|||
error_found = True
|
||||
if error or progress:
|
||||
print(msg, file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
assert not self._active_txn
|
||||
index_transaction_id = self.get_index_transaction_id()
|
||||
|
|
|
|||
Loading…
Reference in a new issue