@@ -156,6 +156,16 @@ func (i *InstallCommand) checkAndConfigureArgs() error {
156156 }
157157 }
158158
159+ if len (i .Args ) > 0 {
160+ i .logDebug ("Removing leading/trailing quotes from arguments..." )
161+ for j := range i .Args {
162+ n := len (i .Args [j ]) - 1
163+ if i .Args [j ][0 ] == '\'' && i.Args [j ][n ] == '\'' {
164+ i .Args [j ] = i .Args [j ][1 :n ]
165+ }
166+ }
167+ }
168+
159169 if i .DisplayName == "" {
160170 i .logDebug ("Creating a display name.." )
161171 i .DisplayName = i .Name
@@ -255,7 +265,7 @@ type cerberusSvc struct {
255265// Execute will be called when the service is started.
256266func (c * cerberusSvc ) Execute (args []string , r <- chan svc.ChangeRequest , changes chan <- svc.Status ) (svcSpecificEC bool , exitCode uint32 ) {
257267 changes <- svc.Status {State : svc .StartPending }
258- cmd := exec.Cmd {Path : c .cfg .ExePath , Dir : c .cfg .WorkDir , Args : c .cfg .Args , Env : append (os .Environ (), c .cfg .Env ... )}
268+ cmd := exec.Cmd {Path : c .cfg .ExePath , Dir : c .cfg .WorkDir , Args : append ([] string { c .cfg .ExePath }, c . cfg . Args ... ) , Env : append (os .Environ (), c .cfg .Env ... )}
259269 if err := cmd .Start (); err != nil {
260270 c .log .Error (2 , fmt .Sprintf ("Failed to start service: %v" , err ))
261271 return false , 2
@@ -275,7 +285,7 @@ loop:
275285 select {
276286 case err := <- done :
277287 if err != nil {
278- c .log .Error (3 , fmt .Sprintf ("Executable exited with error: %v" , err ))
288+ c .log .Error (3 , fmt .Sprintf ("Executable '%v' exited with error: %v" , c . cfg . ExePath , err ))
279289 exitCode = 3
280290 }
281291 break loop
0 commit comments