File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func (st *ServiceTemplate) Generate(args *ServiceTemplateArgs) error {
4444 return err
4545 }
4646 if _ , err = os .Stat (resolvedPath ); err == nil {
47- return fmt .Errorf ("cloudflared service is already installed at %s" , resolvedPath )
47+ return fmt .Errorf (serviceAlreadyExistsWarn ( resolvedPath ) )
4848 }
4949
5050 var buffer bytes.Buffer
@@ -75,6 +75,15 @@ func (st *ServiceTemplate) Remove() error {
7575 return nil
7676}
7777
78+ func serviceAlreadyExistsWarn (service string ) string {
79+ return fmt .Sprintf ("cloudflared service is already installed at %s; if you are running a cloudflared tunnel, you " +
80+ "can point it to multiple origins, avoiding the need to run more than one cloudflared service in the " +
81+ "same machine; otherwise if you are really sure, you can do `cloudflared service uninstall` to clean " +
82+ "up the existing service and then try again this command" ,
83+ service ,
84+ )
85+ }
86+
7887func runCommand (command string , args ... string ) error {
7988 cmd := exec .Command (command , args ... )
8089 stderr , err := cmd .StderrPipe ()
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ func installWindowsService(c *cli.Context) error {
191191 log := zeroLogger .With ().Str (LogFieldWindowsServiceName , windowsServiceName ).Logger ()
192192 if err == nil {
193193 s .Close ()
194- return fmt .Errorf ("Service %s already exists" , windowsServiceName )
194+ return fmt .Errorf (serviceAlreadyExistsWarn ( windowsServiceName ) )
195195 }
196196 extraArgs , err := getServiceExtraArgsFromCliArgs (c , & log )
197197 if err != nil {
You can’t perform that action at this time.
0 commit comments