Change in osmo-gsm-tester[master]: process: add stdin_write method to communicate with child on stdin

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

srs_andre gerrit-no-reply at lists.osmocom.org
Sat Mar 21 21:44:52 UTC 2020


srs_andre has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17560 )


Change subject: process: add stdin_write method to communicate with child on stdin
......................................................................

process: add stdin_write method to communicate with child on stdin

Change-Id: I3e5d843911998bb50726d93e3dfd3de584dc81a5
---
M src/osmo_gsm_tester/process.py
1 file changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/60/17560/1

diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index f399b29..4561a48 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -350,6 +350,15 @@
     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)
+        '''
+        try:
+            self.process_obj.communicate(input="{}".format(cmd).encode("utf-8"), timeout=5)
+        except subprocess.TimeoutExpired:
+            self.log('Timeout expired while writing to stdout')
+
 
 class RemoteProcess(Process):
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17560
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I3e5d843911998bb50726d93e3dfd3de584dc81a5
Gerrit-Change-Number: 17560
Gerrit-PatchSet: 1
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200321/31e4530a/attachment.htm>


More information about the gerrit-log mailing list