mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 09:02:11 +01:00
21 lines
562 B
Go
21 lines
562 B
Go
package frankenphp
|
|
|
|
// #include "frankenphp.h"
|
|
import "C"
|
|
import "unsafe"
|
|
|
|
// ExecuteScriptCLI executes the PHP script passed as parameter.
|
|
// It returns the exit status code of the script.
|
|
func ExecuteScriptCLI(script string, args []string) int {
|
|
// Ensure extensions are registered before CLI execution
|
|
registerExtensions()
|
|
|
|
cScript := C.CString(script)
|
|
defer C.free(unsafe.Pointer(cScript))
|
|
|
|
argc, argv := convertArgs(args)
|
|
defer freeArgs(argv)
|
|
|
|
return int(C.frankenphp_execute_script_cli(cScript, argc, (**C.char)(unsafe.Pointer(&argv[0])), false))
|
|
}
|