Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start-Service is treating [ as a special character and unable to start service #3515

Closed
NickJosevski opened this issue May 22, 2017 · 3 comments

Comments

@NickJosevski
Copy link

commented May 22, 2017

On the start service line, it'll error in Octopus, because it fails to start, see this ticket raised by customer

Write-Host "Starting the $serviceName service"
Start-Service $ServiceName

https://github.com/OctopusDeploy/Calamari/blob/master/source/Calamari/Scripts/Octopus.Features.WindowsService_BeforePostDeploy.ps1#L163

Here are raw log output of it failing to start service [T3]asdfasdfasdf - ServerTasks-4491.log.txt

Trying to make use of [Regex]::Escape($ServiceName) doesn't help, it injects backslashes and it produces

[Regex]::Escape("[T3]asdfasdfasdf")
\[T3]asdfasdfasdf

In PowerShell by hand the only success I had starting the service was using the back tick:

 Start-Service '`[T3]asdfasdfasdf' 

I couldn't find consistent info/answers for how to properly escape and what, but see this and more info on regex::escape here lists the following: \, *, +, ?, |, {, [, (,), ^, $,., #, and white space

@NickJosevski

This comment has been minimized.

Copy link
Author

commented May 22, 2017

Here's a nuget package that contains a service call echosvc.exe (had to zip it to upload here)
service.2017.5.22.121522.nupkg.zip

johnsimons added a commit to OctopusDeploy/Calamari that referenced this issue Jun 19, 2017
johnsimons added a commit to OctopusDeploy/Calamari that referenced this issue Jun 21, 2017
johnsimons added a commit to OctopusDeploy/Calamari that referenced this issue Jul 3, 2017
@johnsimons johnsimons self-assigned this Jul 3, 2017
@johnsimons johnsimons added this to the 3.15.1 milestone Jul 3, 2017
@johnsimons

This comment has been minimized.

Copy link

commented Jul 3, 2017

Release Note: Start-Service was treating [ as a special character and was unable to start the service

@lock

This comment has been minimized.

Copy link

commented Nov 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.