in my ruby code, I have to search lines from the file and then process. below is the code to run the zgrep on the file and then process the output. the code is not running. I get below error all the time.
2022-09-19 15:24:/src/SVSHelpers/file_search.rb(20):INFO:{"scanid"=>"110718", "rawrev"=>"SC_FLD_IODB0", "srchpattern"=>".*pie_mcawrp.FatalErrDetected", "limit"=>"20"}
2022-09-19 15:24:/src/SVSHelpers/file_search.rb(23):INFO:zgrep -i -m20 ".*pie_mcawrp.FatalErrDetected" /proj/platform_scandump/scanview30/ASCII/ScanviewStg/110718.txt.gz
2022-09-19 15:24:/src/SVSHelpers/file_search.rb(45):ERROR:problem in signal retrieval command: zgrep -i -m20 ".*pie_mcawrp.FatalErrDetected" /proj/platform_scandump/scanview30/ASCII/ScanviewStg/110718.txt.gz, error : undefined method `flush' for ScanView::ReportScriptingHelper::ScanViewScript, searchedline :
here is my code:
items["srchpattern"] = items["srchpattern"].gsub("?", ".*")
$logger.info("#{items}")
command = "zgrep -i -m" + items["limit"] + ' "' + items["srchpattern"] + '" ' + $ascii_file_path + '/' + items["scanid"] +'.txt.gz'
#command='zgrep -i -m20 ".*pie_mcawrp.FatalErrDetected" /proj/platform_scandump/scanview30/ASCII/ScanviewStg/110718.txt.gz'
$logger.info("#{command}")
ll = `#{command}`
$logger.info("found lines : #{ll}")
searchedlines = ll.split("\n")
signals = []
for line in searchedlines do
tokens = line.split(",")
signals.push({
"signalNameString": tokens[0],
"signalHexValueString": tokens[1],
"signalDecimalValue": tokens[1].to_i(16)
})
end
return JSON.dump({
"statusmsg": "passed",
"data": {
"scanOrSystemIdString": items["scanid"],
"rtlSignalDatApisList": signals
}
})
this code is executed in the instant_eval. if run outside of instant_eval it runs alright. also it is running fine on window. however creating problem on Linux.