Skip to content

Commit

Permalink
feat: allow running embedded CLI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 3, 2023
1 parent 49d81c4 commit 7536b89
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions caddy/php-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package caddy
import (
"errors"
"os"
"path/filepath"

caddycmd "github.com/caddyserver/caddy/v2/cmd"
"github.com/dunglas/frankenphp"
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 7536b89

Please sign in to comment.