File: ReadCmdFile.lua

package info (click to toggle)
lmod 8.7.60-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,008 kB
  • sloc: sh: 6,266; makefile: 2,837; ansic: 1,513; tcl: 1,382; python: 1,050; csh: 112
file content (16 lines) | stat: -rw-r--r-- 362 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ReadCmdFile = BaseTask:new()

local load = (_VERSION == "Lua 5.1") and loadstring or load
function ReadCmdFile:execute(myTable)
   local masterTbl = masterTbl()
   local cmdFn     = masterTbl.pargs[1]
   
   if (not cmdFn) then return end

   local cmdFile = io.open(cmdFn,"r")

   local s = cmdFile:read("*all")
   assert(load(s))()

   masterTbl.cmd = cmd
end