mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 00:52:11 +01:00
feat: allow running embedded CLI scripts
This commit is contained in:
@@ -3,6 +3,7 @@ package caddy
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
caddycmd "github.com/caddyserver/caddy/v2/cmd"
|
||||
"github.com/dunglas/frankenphp"
|
||||
@@ -30,6 +31,12 @@ func cmdPHPCLI(fs caddycmd.Flags) (int, error) {
|
||||
return 1, errors.New("the path to the PHP script is required")
|
||||
}
|
||||
|
||||
if frankenphp.EmbeddedAppPath != "" {
|
||||
if _, err := os.Stat(args[0]); err != nil {
|
||||
args[0] = filepath.Join(frankenphp.EmbeddedAppPath, args[0])
|
||||
}
|
||||
}
|
||||
|
||||
status := frankenphp.ExecuteScriptCLI(args[0], args)
|
||||
os.Exit(status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user