-
Notifications
You must be signed in to change notification settings - Fork 10
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
OSX/Linux Support #253
Comments
This may be a possible solution current have a fork so may try and PR this need check for any other references to windows only: https://stackoverflow.com/questions/23679283/c-sharp-execute-a-terminal-command-in-linux/23681651#23681651 |
This is something we'd like to do but haven't got to yet. The weird behaviour around As for the That said .NET Core 3.0 added support for killing entire process trees, so it's possible that we could just switch to that. |
Based on a very quick experiment, this appears to work for launching var pi = new ProcessStartInfo("npm", "prefix -g");
var p = new Process { StartInfo = pi };
p.Start(); so on the face of it, it looks like the PATH issues we encountered on Windows are not an issue. (It's also possible, I suppose, that they're no longer a problem in Windows either—we haven't changed this for a while.) |
This isn't only need for local dev but also for CI/CD pipelines. I want to deploy my functions to a Linux plan and want to run my tests in Azure Pipelines on a Linux agent. I just spent a day trying to figure out why my tests wouldn't run and then I came across this issue. I didn't see anywhere in the documentation saying this was a Windows only library. Since it is built on netstandard2.0 I just assumed it would run on Linux. |
In general this is no guarantee. The The only thing And if you look at what That raises the question of what you'd actually expect a Linux box to do when asked to return a list of So I'd expect the only way for us to fix this is to find some way to achieve the same effect without using As I said earlier in the thread, we do want to fix this—we have several build pipelines currently using Windows where we'd prefer to use Linux (because if you're using single-use discardable build agents, Linux ones generally take less time to provision), but where we're stuck on Windows partly because of this limitation in this library. (Although there's also the fact that we've encountered a lot of problems deploying to Linux-based Azure Functions, meaning that in most cases we use Windows for the production deployments, at which point you tend to want to run your tests on Windows.) So we do intend to fix this. It just hasn't reached the top of our priority list yet. |
PRs from people well versed in the Linux side of this would be very welcome, though. |
Since I'd already taken a look at the issues to be able to write a vaguely cogent reply, I thought I'd see if it's relatively straightforward. There's a draft PR, #271 which attempts to address the issues I know about. If you're feeling adventurous, I've produced a pre-release NuGet package https://www.nuget.org/packages/Corvus.Testing.AzureFunctions/1.5.0-253-unix-support.2 that you could try out to see if it works, but be aware that I've not tested it at all yet. |
I have tried this out and there is an issue with how you are checking for the azure functions core tools. Using To fix this you should use
to
I unfortunately do not currently have a Linux environment set up so I could only test this on Azure Pipelines with both a Windows and Linux agent and printing out the results of the |
I have gotten a local Linux environment set up to test this and I can confirm that the changes I outlined above do fix the npm issue with one small change - the path to the 'azure-functions-core-tools\bin' needs to use the OS specific directory separator. (@$"azure-functions-core-tools{Path.DirectorySeparatorChar}bin"). That is the good news. The bad news is that it is throwing an exception (System.ComponentModel.Win32Exception : No such file or directory) when it tries to start the process to run 'npm root -g'. From my search online this is supposed to work so not sure why it isn't. I will take another look at this on the weekend. *** UPDATE ***
My tests are now working locally on Linux but every second test is failing with this exception
I am assuming it is because the port is still in use when the test runs. This could be related to the fact I am running everything in a Docker container. Also, they are still not running on Azure Pipelines. I am still getting the same Win32 exception and I don't know how to get the debug output from the logger to print out in the pipeline. Any help on this would be appreciated. |
The current implementation as shown relies on
cmd.exe
which is not supported by any other operating system other than windows.The text was updated successfully, but these errors were encountered: