forked from DGNum/liminix
ifwait: don't run on load if in test harness
This commit is contained in:
parent
38ed91f641
commit
0787807a7f
2 changed files with 17 additions and 10 deletions
|
@ -33,12 +33,17 @@
|
|||
(when (. got params.expecting)
|
||||
(os.exit 0))))
|
||||
|
||||
(let [parameters
|
||||
(assert (parse-args arg)
|
||||
(.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]"))]
|
||||
(when parameters.verbose
|
||||
(print (.. (. arg 0) ": waiting for "
|
||||
parameters.link " to be " parameters.expecting)))
|
||||
(fn run []
|
||||
(let [parameters
|
||||
(assert (parse-args arg)
|
||||
(.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]"))]
|
||||
(when parameters.verbose
|
||||
(print (.. (. arg 0) ": waiting for "
|
||||
parameters.link " to be " parameters.expecting)))
|
||||
|
||||
(each [event (nl.events {:link true})]
|
||||
(run-event parameters event)))
|
||||
(each [event (nl.events {:link true})]
|
||||
(run-event parameters event))))
|
||||
|
||||
(when (not (= (. arg 0) "test")) (run))
|
||||
|
||||
{ : run }
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
(tset package.loaded :anoia.nl { :events events })
|
||||
|
||||
(set _G.arg (doto ["-v" "dummy0" "up"] (tset 0 "ifwait")))
|
||||
(set _G.arg (doto ["-v" "dummy0" "up"] (tset 0 "test")))
|
||||
|
||||
(fennel.dofile "ifwait.fnl" { :correlate true })
|
||||
(local ifwait (require :ifwait))
|
||||
|
||||
(ifwait.run)
|
||||
|
|
Loading…
Reference in a new issue