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

Fix pull-platformplatform-changes CLI command on Windows #655

Conversation

thiagolunardi
Copy link
Contributor

@thiagolunardi thiagolunardi commented Dec 30, 2024

Summary & Motivation

While running on Windows, the pp pull-platform platform-changes fails because it couldn't find the npm command, which is not an executable file.

This fix searches for the precise command location while running on Windows OS using the .exe and .cmd extensions.

Checklist

  • I have added tests, and done manual regression tests
  • I have updated the documentation, if necessary

@CLAassistant
Copy link

CLAassistant commented Dec 30, 2024

CLA assistant check
All committers have signed the CLA.

@thiagolunardi thiagolunardi marked this pull request as ready for review December 31, 2024 12:21
@thiagolunardi thiagolunardi force-pushed the pp-285-bug-pull-platformplatform-changes-on-windows branch 2 times, most recently from 3317f54 to 37d6223 Compare January 1, 2025 12:05
Copy link
Member

@tjementum tjementum left a comment

Choose a reason for hiding this comment

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

Hi Tiago

Thanks for the pull request, and sorry for the late reply. I get an exception on my Mac when running this, and I had to debug to find out what was wrong. It turns out this is because the PATH environment variable on Linux and macOS is split using : and not ; like on Windows.

I made a comment and a suggested fix, but I will have to test that this did not break anything else. I don't have tests for the Developer CLI.

Also, I always rebase branches before merging to main, and I never merge main into a feature branch. Please rebase your changes and squash everything, including my suggested change, into a single commit, and then force push the branch to your repository.

developer-cli/Utilities/ProcessHelper.cs Outdated Show resolved Hide resolved
developer-cli/Utilities/ProcessHelper.cs Outdated Show resolved Hide resolved
@tjementum tjementum added the Enhancement New feature or request label Jan 4, 2025
@tjementum tjementum requested a review from a team as a code owner January 4, 2025 01:28
@tjementum tjementum removed the Enhancement New feature or request label Jan 4, 2025
@tjementum tjementum linked an issue Jan 4, 2025 that may be closed by this pull request
2 tasks
@tjementum tjementum added the Enhancement New feature or request label Jan 4, 2025
@tjementum tjementum force-pushed the pp-285-bug-pull-platformplatform-changes-on-windows branch from ffc2070 to fdd997a Compare January 4, 2025 12:30
@thiagolunardi
Copy link
Contributor Author

Hi @tjementum

I can try adding a test project to it and putting together a workflow to test this functionality initially. I can run it on Windows, Linux, and Mac. For example, I can run npm—v and expect to get its version across all platforms.

public static class ProcessHelperTests
{
    public class StartProcessTests 
    {
        [Theory]
        [InlineData("npm -v")
        public void RequestVersion_ShouldReturnValidSemver(string command)
        {
                // Act
                var output = ProcessHelper.StartProcess(
                    command,
                    redirectOutput: true,
                    throwOnError: true);

                // Assert
                Assert.True(Version.TryParse(output, out _));
        }
    }
}

For that, I will need to make a tiny move and change the directory structure to look like this:

.
.
├─ development-cli       # Contains the development CLI source code
│  ├─ cli                # A .NET CLI tool for automating common developer tasks
│  ├─ tests              # Tests for the CLI

Do you think it makes sense?

@tjementum tjementum force-pushed the pp-285-bug-pull-platformplatform-changes-on-windows branch 2 times, most recently from 7f45b4a to cfdfdcf Compare January 4, 2025 12:59
@tjementum tjementum added Enhancement New feature or request and removed Enhancement New feature or request labels Jan 4, 2025
@tjementum tjementum changed the title Fix pull-platformplatform-changes on Windows Fix pull-platformplatform-changes CLI command on Windows Jan 4, 2025
@tjementum tjementum force-pushed the pp-285-bug-pull-platformplatform-changes-on-windows branch 2 times, most recently from 69da856 to b4aa156 Compare January 7, 2025 11:36
@tjementum tjementum enabled auto-merge January 7, 2025 12:42
Copy link
Member

@tjementum tjementum left a comment

Choose a reason for hiding this comment

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

I've made the requested changes and force pushed them.

@tjementum tjementum force-pushed the pp-285-bug-pull-platformplatform-changes-on-windows branch from b4aa156 to 290139a Compare January 7, 2025 12:49
@tjementum tjementum merged commit 6018f8a into platformplatform:main Jan 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

The CLI command pull-platform-changes fails on Windows
3 participants