jolly submitted this change.
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
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(-)
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.