From 6e7b1489547b4fd5bd5faf49b1172b68fc14a257 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 19 Mar 2017 19:19:34 +0300 Subject: [PATCH] Fix mysql2sql: do not mix output and messages Inhibit progress bar and log messages if the output is stdout. --- scripts/mysql2sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/mysql2sql b/scripts/mysql2sql index e4f2e4b..7e29c2e 100755 --- a/scripts/mysql2sql +++ b/scripts/mysql2sql @@ -31,7 +31,8 @@ def main(infile, encoding, outfile, output_encoding, use_pbar, quoting_style): if size is None: use_pbar = False - print("Converting: ", end='', file=sys.stderr) + if use_pbar: + print("Converting: ", end='', file=sys.stderr) sys.stderr.flush() if use_pbar: @@ -66,7 +67,7 @@ def main(infile, encoding, outfile, output_encoding, use_pbar, quoting_style): if use_pbar: pbar.erase() - print("done.") + print("done.") if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert MySQL to SQL') @@ -133,6 +134,7 @@ if __name__ == '__main__': if outfile == '-': outfile = sys.stdout + args.no_pbar = True else: try: outfile = open(outfile, 'wt', encoding=output_encoding) -- 2.39.5