TUN-5867: Return error if service was already installed

This commit is contained in:
cthuang 2022-03-15 14:18:21 +00:00
parent 8cbd222e10
commit ca43b0357f
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,10 @@ func (st *ServiceTemplate) Generate(args *ServiceTemplateArgs) error {
if err != nil { if err != nil {
return err return err
} }
if _, err = os.Stat(resolvedPath); err == nil {
return fmt.Errorf("cloudflared service is already installed at %s", resolvedPath)
}
var buffer bytes.Buffer var buffer bytes.Buffer
err = tmpl.Execute(&buffer, args) err = tmpl.Execute(&buffer, args)
if err != nil { if err != nil {