-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import subprocess | ||
import time | ||
import logging | ||
from watchdog.observers import Observer | ||
from watchdog.events import FileSystemEventHandler | ||
# | ||
# | ||
# class ConsoleOutputEventHandler(FileSystemEventHandler): | ||
# def __init__(self, expected_output): | ||
# super().__init__() | ||
# self.expected_output = expected_output | ||
# self.prev_output = "" | ||
# | ||
# def on_modified(self, event): | ||
# with open(event.src_path) as f: | ||
# output = f.read() | ||
# if self.expected_output in output and self.expected_output != self.prev_output: | ||
# logging.info(f"{self.expected_output}가 출력됩니다") | ||
# self.prev_output = self.expected_output | ||
# | ||
# | ||
# def monitor_console_output(command, expected_output): | ||
# logging.info(f"{command} 명령어를 실행합니다") | ||
# with open("output.txt", "w") as f: | ||
# subprocess.call(command, stdout=f, shell=True) | ||
# | ||
# logging.info(f"{expected_output} 출력을 모니터링합니다") | ||
# event_handler = ConsoleOutputEventHandler(expected_output) | ||
# observer = Observer() | ||
# observer.schedule(event_handler, ".", recursive=False) | ||
# observer.start() | ||
# | ||
# try: | ||
# while True: | ||
# time.sleep(1) | ||
# except KeyboardInterrupt: | ||
# observer.stop() | ||
# observer.join() | ||
# | ||
# | ||
# logging.basicConfig(level=logging.INFO) | ||
# monitor_console_output("python www.py", "2") | ||
import subprocess | ||
|
||
cmd = "python www.py" | ||
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') | ||
while True: | ||
output = process.stdout.readline() | ||
if output == '' and process.poll() is not None: | ||
break | ||
if output: | ||
print(output.strip()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from tqdm import tqdm | ||
|
||
# with open("output.txt", "w") as f: | ||
for i in tqdm(range(100000000)): | ||
pass |