We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 59971e3 commit 7ce9002Copy full SHA for 7ce9002
1 file changed
src/template/runner.cr
@@ -0,0 +1,40 @@
1
+module Lua
2
+ class Runner
3
+ @script : String
4
+ @output : IO
5
+ @state : Lua::State
6
+
7
+ def initialize(@script, @output)
8
+ @state = Lua::State.new
9
+ @state.open :all
10
+ end
11
12
+ def load_normal_env : Nil
13
+ Lua.create_function @state, "current_dir" do |_|
14
+ Dir.current
15
16
17
+ Lua.create_function @state, "run_command" do |args|
18
+ command, *rest = args.map(&.as_s) rescue raise "expected all string arguments to 'run_command'"
19
+ Process.run(command, rest).exit_code
20
21
22
23
+ def load_test_env : Nil
24
25
26
27
28
+ Lua.create_function @state, "run_command" do |_|
29
+ 0
30
31
32
33
+ def load_checks_env : Nil
34
+ # TODO
35
36
37
+ def run : Nil
38
39
40
+end
0 commit comments