-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathrun.go
More file actions
44 lines (41 loc) · 1.27 KB
/
run.go
File metadata and controls
44 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"context"
"log"
"os"
"github.com/KarpelesLab/goro/core/ini"
"github.com/KarpelesLab/goro/core/phpctx"
_ "github.com/KarpelesLab/goro/ext/bz2"
_ "github.com/KarpelesLab/goro/ext/curl"
_ "github.com/KarpelesLab/goro/ext/ctype"
_ "github.com/KarpelesLab/goro/ext/date"
_ "github.com/KarpelesLab/goro/ext/gmp"
_ "github.com/KarpelesLab/goro/ext/hash"
_ "github.com/KarpelesLab/goro/ext/json"
_ "github.com/KarpelesLab/goro/ext/openssl"
_ "github.com/KarpelesLab/goro/ext/mbstring"
_ "github.com/KarpelesLab/goro/ext/mysqli"
_ "github.com/KarpelesLab/goro/ext/sqlite3"
_ "github.com/KarpelesLab/goro/ext/pcre"
_ "github.com/KarpelesLab/goro/ext/reflection"
_ "github.com/KarpelesLab/goro/ext/session"
_ "github.com/KarpelesLab/goro/ext/sockets"
_ "github.com/KarpelesLab/goro/ext/spl"
_ "github.com/KarpelesLab/goro/ext/standard"
_ "github.com/KarpelesLab/goro/ext/xml"
_ "github.com/KarpelesLab/goro/ext/zlib"
)
func main() {
// by default, run script test.php
p := phpctx.NewProcess("cli")
p.CommandLine(os.Args)
ctx := phpctx.NewGlobal(context.Background(), p, ini.New())
file := "test.php"
if len(os.Args) > 1 {
file = os.Args[1]
}
if err := ctx.RunFile(file); err != nil {
log.Printf("failed to run test file: %s", err)
os.Exit(1)
}
}