Skip to content

Commit

Permalink
fix: the service status output is missing (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Apr 27, 2023
1 parent e27be10 commit 5af79c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin/
.idea/
coverage.out
dist/
.vscode/launch.json
4 changes: 3 additions & 1 deletion cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ func (o *serviceOption) runE(c *cobra.Command, args []string) (err error) {
var output string
switch o.action {
case "install", "i":
err = os.WriteFile(o.scriptPath, []byte(script), os.ModeAppend)
if err = os.WriteFile(o.scriptPath, []byte(script), os.ModeAppend); err == nil {
output, err = o.Execer.RunCommandAndReturn("systemctl", "", "enable", "atest")
}
case "start":
output, err = o.Execer.RunCommandAndReturn("systemctl", "", "start", "atest")
case "stop":
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/golang/protobuf v1.5.2
github.com/h2non/gock v1.2.0
github.com/invopop/jsonschema v0.7.0
github.com/linuxsuren/go-fake-runtime v0.0.0-20230413085645-15e77ab55dbd
github.com/linuxsuren/go-fake-runtime v0.0.0-20230426144714-1a7a0d160d3f
github.com/linuxsuren/unstructured v0.0.1
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.2
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230413085645-15e77ab55dbd h1:2Avir30WOgcDqG3sA4hlW4bC4c/tgseAUntPhf5JQ6E=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230413085645-15e77ab55dbd/go.mod h1:zmh6J78hSnWZo68faMA2eKOdaEp8eFbERHi3ZB9xHCQ=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230426143116-85f55baf088f h1:QvE5qCxn6uNxIpF4dnX8O172J12+iOFBcmQ52rvhFFU=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230426143116-85f55baf088f/go.mod h1:zmh6J78hSnWZo68faMA2eKOdaEp8eFbERHi3ZB9xHCQ=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230426144714-1a7a0d160d3f h1:TfAzkLxq/agwMBbccTx/f/dlmFWIBLWRGCWjI4IOlK8=
github.com/linuxsuren/go-fake-runtime v0.0.0-20230426144714-1a7a0d160d3f/go.mod h1:zmh6J78hSnWZo68faMA2eKOdaEp8eFbERHi3ZB9xHCQ=
github.com/linuxsuren/unstructured v0.0.1 h1:ilUA8MUYbR6l9ebo/YPV2bKqlf62bzQursDSE+j00iU=
github.com/linuxsuren/unstructured v0.0.1/go.mod h1:KH6aTj+FegzGBzc1vS6mzZx3/duhTUTEVyW5sO7p4as=
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
Expand Down

0 comments on commit 5af79c7

Please sign in to comment.