openwrt-openwisp-monitoring icon indicating copy to clipboard operation
openwrt-openwisp-monitoring copied to clipboard

[refactor] Use utility function for calling popen() properly

Open nemesifier opened this issue 3 years ago • 2 comments

It would be good to create a utility function which does the read, close and returning of the output when using io.popen().

This would also ensure that whoever will put their hands on this code will keep reusing our function and avoid messing it up again by forgetting to close a pipe.

nemesifier avatar Aug 13 '21 00:08 nemesifier

The current problem I am facing with this is that if we create a function in monitoring_utils.lua and load it, then the io defined in first table, TestNeighbor or TestInterface is getting used by the next one, i.e. TestNetJSON

Opened a thread here:- https://www.luaforum.com/threads/not-able-to-mock-io-library.505/

devkapilbansal avatar Aug 13 '21 10:08 devkapilbansal

Hi, would like to contribute to this issue

Saurabh-Mokashi avatar Mar 14 '22 17:03 Saurabh-Mokashi