def parv(lvl):
if opt.verbose >= lvl:
- if istty:
+ if istty2:
return []
else:
return ['-q']
if not opt.verbose:
progress('fsck (%d/%d)\r' % (count, len(extra)))
-if not opt.verbose and istty:
+if not opt.verbose and istty2:
log('fsck done. \n')
sys.exit(code)
if not extra:
o.fatal("no filenames given")
-opt.progress = (istty and not opt.quiet)
+opt.progress = (istty2 and not opt.quiet)
opt.smaller = parse_num(opt.smaller or 0)
if opt.bwlimit:
client.bwlimit = parse_num(opt.bwlimit)
#include <stdlib.h>
#include <stdio.h>
-static int istty = 0;
+static int istty2 = 0;
// Probably we should use autoconf or something and set HAVE_PY_GETARGCARGV...
#if __WIN32__ || __CYGWIN__
{
struct idx *idx;
uint32_t new_prefix;
- if (count % 102424 == 0 && istty)
+ if (count % 102424 == 0 && istty2)
fprintf(stderr, "midx: writing %.2f%% (%d/%d)\r",
count*100.0/total, count, total);
idx = idxs[last_i];
PyMODINIT_FUNC init_helpers(void)
{
+ char *e = getenv("BUP_FORCE_TTY");
Py_InitModule("_helpers", faster_methods);
- istty = isatty(2) || getenv("BUP_FORCE_TTY");
+ istty2 = isatty(2) || (atoi(e ? e : "0") & 2);
unpythonize_argv();
}
log(s)
-istty = os.isatty(2) or atoi(os.environ.get('BUP_FORCE_TTY'))
+istty1 = os.isatty(1) or (atoi(os.environ.get('BUP_FORCE_TTY')) & 1)
+istty2 = os.isatty(2) or (atoi(os.environ.get('BUP_FORCE_TTY')) & 2)
_last_progress = ''
def progress(s):
"""Calls log() if stderr is a TTY. Does nothing otherwise."""
global _last_progress
- if istty:
+ if istty2:
log(s)
_last_progress = s