client.py: chdir

This commit is contained in:
JerryXiao 2019-09-06 13:05:07 +08:00
parent 4089802b00
commit 0518ebf199
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -4,6 +4,7 @@
# This file is part of Buildbot by JerryXiao # This file is part of Buildbot by JerryXiao
import logging import logging
import os
from multiprocessing.connection import Client from multiprocessing.connection import Client
from time import sleep from time import sleep
@ -15,6 +16,10 @@ from utils import print_exc_plus
logger = logging.getLogger(f'buildbot.{__name__}') logger = logging.getLogger(f'buildbot.{__name__}')
abspath=os.path.abspath(__file__)
abspath=os.path.dirname(abspath)
os.chdir(abspath)
def run(funcname, args=list(), kwargs=dict(), retries=0, server=(REPOD_BIND_ADDRESS, REPOD_BIND_PASSWD)): def run(funcname, args=list(), kwargs=dict(), retries=0, server=(REPOD_BIND_ADDRESS, REPOD_BIND_PASSWD)):
try: try:
logger.info('client: %s %s %s',funcname, args, kwargs) logger.info('client: %s %s %s',funcname, args, kwargs)
@ -41,7 +46,6 @@ if __name__ == '__main__':
from utils import configure_logger from utils import configure_logger
configure_logger(logger) configure_logger(logger)
def print_log(): def print_log():
import os
os.system(f'tail -n 43 -f \"{CONSOLE_LOGFILE}\"') os.system(f'tail -n 43 -f \"{CONSOLE_LOGFILE}\"')
try: try:
actions = { actions = {