wisski-cloud-distillery/internal/wisski/ingredient/php/server.go
2022-11-16 13:07:14 +01:00

21 lines
596 B
Go

package php
import (
_ "embed"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/php/phpserver"
"github.com/alessio/shellescape"
"github.com/tkw1536/goprogram/stream"
)
type Server = phpserver.Server
// NewServer returns a new server that can execute code within this distillery.
// When err == nil, the caller must call server.Close().
//
// See [PHPServer].
func (php *PHP) NewServer() (*Server, error) {
return phpserver.New(func(str stream.IOStream, script string) {
php.Barrel.Shell(str, "-c", shellescape.QuoteCommand([]string{"drush", "php:eval", script}))
})
}