Move test mode into state

- test mode variable is now in state
This commit is contained in:
Peter Šurda 2018-04-02 08:54:44 +02:00
parent 1a76c1df97
commit bf8c2f44f6
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 8 additions and 7 deletions

View File

@ -221,12 +221,12 @@ class Main:
elif opt in ("-c", "--curses"): elif opt in ("-c", "--curses"):
state.curses = True state.curses = True
elif opt in ("-t", "test"): elif opt in ("-t", "test"):
daemon = 10 state.testmode = True
# is the application already running? If yes then exit. # is the application already running? If yes then exit.
shared.thisapp = singleinstance("", daemon) shared.thisapp = singleinstance("", daemon)
if daemon == 1: if daemon:
with shared.printLock: with shared.printLock:
print('Running as a daemon. Send TERM signal to end.') print('Running as a daemon. Send TERM signal to end.')
self.daemonize() self.daemonize()
@ -343,11 +343,10 @@ class Main:
else: else:
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
if daemon: if state.testmode:
sleep(daemon) sleep(10)
if daemon > 1: self.stop()
# make testing if daemon or state.testmode:
self.stop()
while state.shutdown == 0: while state.shutdown == 0:
sleep(1) sleep(1)

View File

@ -55,3 +55,5 @@ def resetNetworkProtocolAvailability():
resetNetworkProtocolAvailability() resetNetworkProtocolAvailability()
dandelion = 0 dandelion = 0
testmode = False