jolly has uploaded this change for review.

View Change

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(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/66/43266/1
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 change 43266. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5be804e5fa7b9a135cceaf07ac4157895a222b40
Gerrit-Change-Number: 43266
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>