process: add stdin_write method to communicate with child on stdin
Change-Id: I3e5d843911998bb50726d93e3dfd3de584dc81a5
diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index f399b29..5d02ab5 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -350,6 +350,13 @@
def wait(self, timeout=300):
MainLoop.wait(self, self.terminated, timeout=timeout)
+ def stdin_write(self, cmd):
+ '''
+ Send a cmd to the stdin of a process (convert to byte before)
+ '''
+ if self.process_obj.stdin is not None:
+ self.process_obj.stdin.write(cmd.encode("utf-8"))
+ self.process_obj.stdin.flush()
class RemoteProcess(Process):