import os
import logging
import time
import sys
import threading
# print(sys.path)
# from lib.run_cmd import runCommand_wait,runCommand
logger = logging.getLogger()
logging.basicConfig(stream =sys.stdout,level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
def _cmd_to_run(log_dir,cmd):
# logging.info(os.getcwd())
os.system(f"cd /d {os.getcwd()}/{log_dir} && {cmd}")
def run_windows_cmd_withlog_nowait(log_dir,cmd):
# threading.Thread(target=_cmd_to_run, args=(log_dir,cmd),daemon=True).start()
threading.Thread(target=_cmd_to_run, args=(log_dir,cmd)).start()
if __name__ == '__main__':
# shutdown time
logging.info("debug is alive...")
run_windows_cmd_withlog_nowait("log","ping 1.1.1.1 > ping1.txt")
run_windows_cmd_withlog_nowait("log","ping 1.1.1.1 > ping2.txt")
run_windows_cmd_withlog_nowait("log","ping 1.1.1.1 > ping3.txt")
# time.sleep(1)
logging.info("done ...")