rake script weird in cmd.exe, works fine in ruby.exe - rake

I have this rakefile that works fine when called from a "Start Command Prompt with Ruby" instance, but fails when called with rake.bat. This means I can't get it to work on Jenkins at all using the Rake build step plugin.
From what I can tell, it's the rake/clean task that's messing up and deleting all files in a "/Core" directory. I've explicitly excluded this from the CLEAN filelist, but when called from rake.bat, this is completely ignored.
What could possibly be the cause for this?
Edit:
OK, more info. CLEAN.exclude('**/core') is ignored the first time it's run in the Ruby shell too, but subsequent runs are fine. That explains why rake.bat is a problem 100% of the time.
I'm using rake 0.8.7, but the same thing happens with 0.9.2. Ruby version is 1.9.2p290. albacore version is 0.2.7. Windows 7 x64 (same thing happens on Windows Server 2008 R2 Standard)

OK, I solved it.
Should've realised it earlier, but it's mind-boggingly weird.
fails the first time: CLEAN.exclude("**/core", "**/bak", "**/~") # a comment here
this always works: CLEAN.exclude("**/core", "**/bak", "**/~")
I guess I'm henceforth removing all comments that are not on a single line in my rakefiles...

Related

Jenkins pipeline job with PowerShell step runs indefinitely

I ran into an issue with Jenkins and I can't manage to figure it out. The problem is that, as the title suggest, a pipeline job hangs while a PowerShell is running.
The PowerShell script works with the Az.Monitor module to create alerts for Azure Resources. If I comment this script out, everything works well so I think it's safe to say that it is the problem.
Even so, when I run it in a powershell terminal, it works fine. Even stranger, if I run it in a normal Jenkins job (not a pipeline one), it works fine aswell. I even left the job running overnight.
I saw that someone suggested that maybe some hidden prompts appear while running on Jenkins, but I set the $ConfirmPreference variable to "None" and the issue still happens.
What could be the issue?
For me, the issue was the Durable-Task Jenkins plugin. I downgraded it from version 1.34 to 1.33 and it worked.
This plugin was problematic back in 2017-2018 too with the version 1.15.

php executing differently on browser or command line

Good morning guys,
I just built a CentOS server with php 7.0.13 and apache 2.2 and the strangest thing is happening when testing it.
I had a curl script that works perfectly well through the command line but not when invoked through the browser, after investigating a bit, I realized that I can also not write to files if I do it through the browser, but I have no problem whatsoever doing it through the command line.
I assumed that the problem would be on two different php.ini files, but after verifying the phpinfo I realized that both the CL and the browser are loading the same, and all extensions seem to be loading correctly as well, by using get_current_user() I can also verify that the same user is executing both. I would assume the problem would be in apache, but I have no clue as to what could be causing it.
Can someone point out to possible avenues to solve the issue? I have no idea what to do from this point onwards.
As Hassan indicated the problem was with the user executing the script.
I commited an error thinking get_current_user() indicates the user executing the script, it does not, it indicates the file owner.
If you have a similar problem and need to figure who is executing the script use exec('whoami'); instead.
EDIT:Ok although that was one of the errors, the main error was on the fact that SELinux was activated, as soon as I deactivated the scripts started working perfectly.

first call to msbuild hangs

I am using a powershell script that internally calls msbuild to build my solutions. This works in principle, so the solution files are ok.
I can repeat the build, it works flawlessly.
But the build hangs
the first time I start the script (after reboot)
after some time / actions during the work day, no idea what changes
So my suspicion is, that msbuild is using some component that is not loaded when I reboot / that is unloaded during the work.
But I have no clue how to find the problem...
I am using this exe:
C:\Program Files (x86)\MSBuild\14.0\bin\MsBuild.exe
Any ideas?
For anybody running into this issue: Roslyn does a "shared compilation" by default, which means that results of compiles are used for further compilations to gain speed. You can switch this of by providing "False" for UseSharedCompilation in VBPROJ files or using a similar switch for MsBuild. Switching this off will do slower compiles but the run does not hang.

Why does TFS build "partially succeed" on this line?

The Problem
I'm adding a pre-build script to our TFS build that calls npm install among other things. One package, gulp-imagemin, installs a few dependencies that each run a test when they install that says they've installed successfully. TFS is interpreting this output as an error even though it's actually a success message. It causes my build to "partially succeed".
The unrecognizable characters above are supposed to be a checkmark (I can see it when running locally)...apparently TFS is not a fan, but there are other lines in the output where this happens and it doesn't show an error next to it, so I don't think that's the cause.
Here's where that message comes from:
https://github.com/imagemin/gifsicle-bin/blob/master/lib/install.js#L34
Does anyone know why TFS is interpreting this as an error, or how I can fix this? Thanks much!
What I've Tried
I've tried to silence its output (by redirecting stdout and stderr to $null) to no avail. When running my .ps1 script locally, I can successfully silence that message, but when the script runs in TFS it still gets printed out. I'm not sure what the difference is.
I also tried making my script a .cmd script instead of .ps1 and that had an interesting effect. The silencing I originally intended worked, but then it would effectively skip the step and the remaining pre-build steps. When I removed the output redirect to nul so I could debug, it brought me back to the same error above with no new info.

Grails: Where is the startGrails script in Eclipse/STS on the Mac?

In order to fix another problem (Stackoverflow Question 6367763) I needed to modify the startGrails script. I made the necessary updates however the modifications are not being picked up when I run Grails commands from within Eclipse/STS.
I put debug in the script and know it is functioning correctly when I call it directly from the command line. However STS appears to be running the original version.
Does STS have another copy of the startGrails script? How can I update this one or ensure STS links to the version of the startGrails script that I updated?