M
Marcin Tyman
I've got an issue with following code:
<code>
t.cmd('String' => "iptables -t mangle -L", 'Match' => /\#/, 'Timeout' =>
15 )
{ |c|
print c
sleep 1 #THIS IS AN ISSUE I CAN'T UNDERSTAND
if c =~ patternDup #patternDup is RegExp object
rtrnMsg = "DUPLICATED"
iptblsLog.info(c.to_s)
elsif c =~ patternRules #patternRules is RegExp object
rtrnMsg = "RULES"
iptblsLog.info(c.to_s)
else
rtrnMsg = "NO RULES"
iptblsLog.info(c.to_s)
end #if
}
</code>
Without sleep sometimes comparison c with particular RegExp doesn't
work. It isn't due to that regular expression doesn't match string
compared with.
After adding the sleep everything works well.
Please, help me to understand it. Why adding sleep resolved this issue.
Thanks in advance.
<code>
t.cmd('String' => "iptables -t mangle -L", 'Match' => /\#/, 'Timeout' =>
15 )
{ |c|
print c
sleep 1 #THIS IS AN ISSUE I CAN'T UNDERSTAND
if c =~ patternDup #patternDup is RegExp object
rtrnMsg = "DUPLICATED"
iptblsLog.info(c.to_s)
elsif c =~ patternRules #patternRules is RegExp object
rtrnMsg = "RULES"
iptblsLog.info(c.to_s)
else
rtrnMsg = "NO RULES"
iptblsLog.info(c.to_s)
end #if
}
</code>
Without sleep sometimes comparison c with particular RegExp doesn't
work. It isn't due to that regular expression doesn't match string
compared with.
After adding the sleep everything works well.
Please, help me to understand it. Why adding sleep resolved this issue.
Thanks in advance.