Skip to content

Commit

Permalink
Use escape sequence to replace clear (Yelp#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
XIANJUN ZHU authored and justineyster committed Jun 24, 2020
1 parent 2db47a3 commit 331a2b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions detect_secrets/core/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import io
import json
import os
import subprocess
import sys
from builtins import input
from collections import defaultdict
Expand Down Expand Up @@ -465,7 +464,11 @@ def _comparison_generator(old_list, new_list, compare_fn):


def _clear_screen(): # pragma: no cover
subprocess.call(['clear'])
ttyname = os.ttyname(sys.stdout.fileno())
with open(ttyname, 'wb') as tty:
# Use escape sequence instead of "clear" command to avoid incorrect
# starting line calculation in docker env
tty.write(b'\033c')


def _print_context( # pragma: no cover
Expand Down

0 comments on commit 331a2b8

Please sign in to comment.