mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
20 lines
334 B
Go
20 lines
334 B
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os/exec"
|
|
"regexp"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetNginx(t *testing.T) {
|
|
out, err := exec.Command("nginx", "-V").CombinedOutput()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Printf("%s\n", out)
|
|
|
|
r, _ := regexp.Compile("--conf-path=(.*)/(.*.conf)")
|
|
fmt.Println(r.FindStringSubmatch(string(out))[1])
|
|
}
|