최초 프로젝트 업로드 (Script Auto Commit)
This commit is contained in:
34
test_main_short.py
Normal file
34
test_main_short.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
"""짧은 시간 실행 후 자동 종료하는 테스트 스크립트"""
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
import threading
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
# 5초 후 자동 종료 타이머
|
||||
def auto_exit():
|
||||
import time
|
||||
|
||||
time.sleep(5)
|
||||
print("\n[자동 종료] 5초 경과, 프로그램 종료")
|
||||
os._exit(0)
|
||||
|
||||
|
||||
# 타이머 시작
|
||||
timer = threading.Thread(target=auto_exit, daemon=True)
|
||||
timer.start()
|
||||
|
||||
# main.py 실행
|
||||
if __name__ == "__main__":
|
||||
from main import main
|
||||
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
print("\n[종료] 사용자 중단")
|
||||
except SystemExit:
|
||||
pass
|
||||
Reference in New Issue
Block a user