On 0.10.4 I am getting back a try/catch error. I have a gist of it working in 0.10.3 and failing in 0.10.4. Currently this is for the tomcat module. I haven't checked or seen issues in other modules yet.
No errors.
Our Puppet system upgraded servers to 0.10.4, attempted to install the tomcat module and received this failure.
See above gist
This reverts what was implemented with #1126
Its related to this change: https://github.com/chocolatey/choco/commit/e208ca2a6eaf26ee316b32c64aff4105427394c8#diff-208a9466943493065fc7c68d8479cdccR118
I'm calling Start-ChocolateyProcessAsAdmin like this:
Push-Location (Join-Path $catalinaHome 'bin')
Start-ChocolateyProcessAsAdmin ".\service.bat install $($options['serviceName'])"
Pop-Location
and I'm getting the error:
ERROR: The term ' try {
.\service.bat install Tomcat8
} catch {
throw
}' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I'm not sure why the change is causing it to fail, but I do think the push-location should be part of the Start- call's arguments so I'm making that modification.
@skyguy94 I think your script has a possible bug in it. We always say full paths to files. Always.
Before we started up PowerShell from the location of the script, which may have allowed it to work properly.
However this bug seems to be depended on, so we need to fix it. There is more to this than just that that is errorring, and it's a gating issue.
That could be, I'll fix it up to specify the full path, but I'm seeing the issue in a new provisioned server with chef too:
```
DotNet3.5 v3.5.20160716 [Approved]
dotnet3.5 package files install completed. Performing other installation steps.
ERROR: The term ' try {
cmd.exe /c DISM /Online /NoRestart /Enable-Feature /FeatureName:NetFx3ServerFeatures
} catch {
throw
}' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of th
e name, or if a path was included, verify that the path is correct and try again.
The install of dotnet3.5 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\DotNet3.5\Tools\ChocolateyInstall.ps1'.
See log for details.
````
I think its more of an issue with the try...catch and the call & operator. This test fails too:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
Loading personal and system profiles took 1219ms.
C:\WINDOWS\system32> $block = "try { cmd.exe } catch { throw }"
C:\WINDOWS\system32> & $block
& : The term 'try { cmd.exe } catch { throw }' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:3
+ & $block
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (try { cmd.exe } catch { throw }:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
C:\WINDOWS\system32> $block = "try { C:\Windows\system32\cmd.exe } catch { throw }"
C:\WINDOWS\system32> & $block
& : The term 'try { C:\Windows\system32\cmd.exe } catch { throw }' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:3
+ & $block
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (try { C:\Window...catch { throw }:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
C:\WINDOWS\system32> C:\Windows\System32\cmd.exe
I'm seeing that as well. We are working to turn around 0.10.5 to get this fixed ASAP.
Most helpful comment
I'm seeing that as well. We are working to turn around 0.10.5 to get this fixed ASAP.