Skip to content

Checking for 'func' command works on MacOS too - #14

Merged
mark-abrams merged 2 commits into
LogicAppUnit:mainfrom
eashi:main
May 29, 2023
Merged

Checking for 'func' command works on MacOS too#14
mark-abrams merged 2 commits into
LogicAppUnit:mainfrom
eashi:main

Conversation

@eashi

@eashi eashi commented May 18, 2023

Copy link
Copy Markdown
Contributor

This PR changes the code that checks for the func command in PATH so that it works on both Windows and MacOS.

The current code only works on Windows:

  1. The path separator is a semicolon (doesn't work on Mac). This PR changes the code so that it uses the Path.PathSeparator rather than hard-coding a semicolon or a colon. For more information check: https://learn.microsoft.com/en-us/dotnet/api/system.io.path.pathseparator?view=net-7.0
  2. The check assumes that the command file func has the extension suffix .exe. This is true on Windows, but not on MacOS. This PR searches for both cases to support both Windows and MacOS.
  3. The Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) returns null because the option passed EnvironmentVariableTarget.Machine fails on MacOS. Removing the option fixes it and shouldn't cause any unexpected behaviours. For more infomration check https://learn.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariable?view=net-7.0

mark-abrams
mark-abrams previously approved these changes May 18, 2023

@mark-abrams mark-abrams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I've only used the framework on a Windows OS, so it is good to see that someone is using on a MacOS. Have you run into any other problems or issues when using the testing framework on MacOS?

@mark-abrams
mark-abrams merged commit 18845bc into LogicAppUnit:main May 29, 2023
@eashi

eashi commented May 29, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for accepting the PR. I haven't came across any other issues, but will keep you posted. Cheers.

@mark-abrams

Copy link
Copy Markdown
Collaborator

Hi @eashi , I have uploaded version 1.6.0 of LogicAppUnit to Nuget. This includes your changes in PR #14 and also PR #15 for support for the MacOS platform. Thank you for your contribution.

@eashi

eashi commented Jun 6, 2023

Copy link
Copy Markdown
Contributor Author

This is great news, thanks Mark for the great project and active maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants