Skip to content

Commit 5b87cc9

Browse files
committedDec 7, 2020
Fixed my bagpipe but still on the broken phone
1 parent fac3796 commit 5b87cc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎v2/pgrepwc.py

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
halt = None
3434
processedOutputList = None
3535
allFiles = None
36+
writeMutex = Lock()
3637

3738

3839
def main(argv):
@@ -524,6 +525,7 @@ def realtimeFeedback(sig, NULL):
524525
global args
525526
global opts
526527
global allFiles
528+
global writeMutex
527529

528530
timeCounter += 1
529531

@@ -548,7 +550,9 @@ def realtimeFeedback(sig, NULL):
548550
output += ("")
549551

550552
os.system("clear")
553+
writeMutex.acquire()
551554
print(output)
555+
writeMutex.release()
552556

553557

554558
def haltHandler(sig,NULL):
@@ -557,14 +561,17 @@ def haltHandler(sig,NULL):
557561
"""
558562
global halt
559563
global args
564+
global writeMutex
560565

561566
word = args[0]
562567

563568
if halt.value == 0:
564569
halt.value = 1
565570
os.system("clear")
566571
ctrlC = colorWrite("CTRL+C", 'red')
572+
writeMutex.acquire()
567573
answer = input(f"Carregou em {ctrlC} se parar agora poderão haver instâncias de '{colorWrite(word, 'red')}' não encontradas, deseja mesmo sair? ({colorWrite('Y', 'green')}/{colorWrite('N', 'red')})\n")
574+
writeMutex.release()
568575

569576
if answer.lower() == "y":
570577
print("A terminar em segurança...")

0 commit comments

Comments
 (0)
Please sign in to comment.