Executing a System Call
In order to run a system call, you will use the "system" action. This action does not trigger a call the "system" OS function, but a call to popen/pclose which is supposed to be thread safe.
The command will be executed as "sh -c <command>". Pipes and redirections work well. The action is successful if the command return code is 0.
<test name="action_system"> <description>Test action system that should handle system calls in a thread safe way (popen/pclose calls).</description> <action> <system command="touch toto"/> <system command="echo truc | grep truc"/> <system command="echo truc"> <read>truc</read> </system> <system command="echo truc chose"> <reRead>truc.*</reRead> </system> </action> <action expr="KO"> <system command="touch /usr"/> </action> <action expr="KO"> <system command="echo truc | grep chose"/> </action> <action expr="KO"> <system command="echo truc"> <read>bidon</read> </system> </action> <action expr="KO"> <system command="echo truc"> <reRead>chose.*</reRead> </system> </action> </test>
Copyright © Cloud Software Group, Inc. All rights reserved.