Skip to content

Commit 0cae479

Browse files
authored
Merge pull request #936 from JoshuaWatt/silence-kernel
shelldriver: Silence kernel earlier
2 parents 948547e + 4015426 commit 0cae479

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

labgrid/driver/shelldriver.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ def on_activate(self):
7979

8080
self._put_ssh_key(keyfile_path)
8181

82-
# Turn off Kernel Messages to the console
83-
self._run("dmesg -n 1")
84-
8582
def on_deactivate(self):
8683
self._status = 0
8784

@@ -133,6 +130,7 @@ def _await_login(self):
133130
# occours, we can't lose any data this way.
134131
last_before = b''
135132
did_login = False
133+
did_silence_kernel = False
136134

137135
while True:
138136
index, before, _, _ = self.console.expect(
@@ -141,10 +139,15 @@ def _await_login(self):
141139
)
142140

143141
if index == 0:
144-
# we got a promt. no need for any further action to activate
145-
# this driver.
146-
self.status = 1
147-
break
142+
if did_login and not did_silence_kernel:
143+
# Silence the kernel and wait for another prompt
144+
self.console.sendline("dmesg -n 1")
145+
did_silence_kernel = True
146+
else:
147+
# we got a prompt. no need for any further action to
148+
# activate this driver.
149+
self.status = 1
150+
break
148151

149152
elif index == 1:
150153
# we need to login

0 commit comments

Comments
 (0)