jolly has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43266?usp=email )

 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: Add start and stop functions to PIPEasp
......................................................................

Add start and stop functions to PIPEasp

In order to start a process in the background, add a start function that
does not wait for the process to terminate. Also add a stop function
that kills the process and flushes the receive buffer.

Related: SYS#8101
Change-Id: I5be804e5fa7b9a135cceaf07ac4157895a222b40
---
M library/PIPEasp_Templates.ttcn
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  jolly: Looks good to me, approved
  Jenkins Builder: Verified
  dexter: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve




diff --git a/library/PIPEasp_Templates.ttcn b/library/PIPEasp_Templates.ttcn
index 0775a5e..85a8656 100644
--- a/library/PIPEasp_Templates.ttcn
+++ b/library/PIPEasp_Templates.ttcn
@@ -70,4 +70,22 @@
        return f_PIPEasp_exec_sync_PResult(pt, cmdline, tr_PResult(?, ?, rc));
 }

+function f_PIPEasp_exec_async_start(PIPEasp_PT pt,
+                                      charstring cmdline,
+                                      charstring stdin := "") {
+       pt.send(ts_PExecute(cmdline, stdin));
+}
+
+function f_PIPEasp_exec_async_stop(PIPEasp_PT pt,
+                                  charstring progname) {
+       timer t_flush := 0.5;
+
+       pt.send(ts_PExecute("pkill -f " & progname, ""))
+
+       t_flush.start;
+       alt {
+               [] pt.receive { repeat; }
+               [] t_flush.timeout { }
+       }
+}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43266?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5be804e5fa7b9a135cceaf07ac4157895a222b40
Gerrit-Change-Number: 43266
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>

Reply via email to