From 5ff04ee79e1500be6f3abe24dadaedcca4e8c8d4 Mon Sep 17 00:00:00 2001 From: Koala Yeung Date: Tue, 13 Oct 2020 12:19:15 +0800 Subject: [PATCH] example/php: Further improve tests * Improve error handling of internal tools. --- tools/phpfpm/process_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/phpfpm/process_test.go b/tools/phpfpm/process_test.go index e7a48b3..e4515c5 100644 --- a/tools/phpfpm/process_test.go +++ b/tools/phpfpm/process_test.go @@ -135,17 +135,23 @@ func ExampleProcess() { process.User = username // save the config file to basepath + "/etc/php-fpm.conf" - process.SaveConfig(basepath + "/etc/example.conf") - process.Start() + if err := process.SaveConfig(basepath + "/etc/example.conf"); err != nil { + panic(err) + } + if err := process.Start(); err != nil { + panic(err) + } go func() { // do something that needs phpfpm // ... time.Sleep(time.Millisecond * 50) - process.Stop() + _ = process.Stop() }() - process.Wait() + if err := process.Wait(); err != nil { + panic(err) + } // Output: }