Skip to content

[skip changelog] Make i18n:generate task Windows compatible #1360

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

Merged
merged 1 commit into from
Jul 19, 2021
Merged

[skip changelog] Make i18n:generate task Windows compatible #1360

merged 1 commit into from
Jul 19, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jul 16, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Bug fix

  • What is the current behavior?

For the sake of portability of tasks, Task uses mvdan.cc/sh to provide an command interpreter that is independent of the environment. While one of the great strengths of Task, this produces unexpected results in some rare cases. This is one of those cases. There is some unusual interaction between mvdan.cc/sh, Windows, and running the rice embed-go command from the subshell created by the parentheses in this command:

$ task i18n:update
←[32mtask: [i18n:update] go run ./i18n/cmd/main.go catalog generate . > ./i18n/data/en.po
←[0m←[32mtask: [i18n:generate] git add -N ./i18n/data
←[0m←[32mtask: [i18n:generate] git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go)
←[0merror reading package: go/build: go list github.com/arduino/arduino-cli/i18n: exec: "go": executable file not found in %PATH%

(yes, Go is in my PATH).

  • What is the new behavior?

The task runs on Windows without a strange error.

It is my belief that the sole purpose of these parentheses was to group the commands and that there is no need to run these commands in a subshell. If so, the change to using braces to group the commands without the creation of a subshell will have no functional effect on the commands, but will allow the task to run on Windows.

@per1234 per1234 added type: bug os: windows Specific to Windows operating system topic: infrastructure Related to project infrastructure labels Jul 16, 2021
For the sake of portability of tasks, Task uses `mvdan.cc/sh` to provide an command interpreter that is independent of
the environment. While one of the great strengths of Task, this produces unexpected results in some rare cases. This is
one of those cases. There is some unusual interaction between `mvdan.cc/sh`, Windows, and running the `rice embed-go`
command from the subshell created by the parentheses in this command:

```
$ task i18n:update
←[32mtask: [i18n:update] go run ./i18n/cmd/main.go catalog generate . > ./i18n/data/en.po
←[0m←[32mtask: [i18n:generate] git add -N ./i18n/data
←[0m←[32mtask: [i18n:generate] git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go)
←[0merror reading package: go/build: go list github.com/arduino/arduino-cli/i18n: exec: "go": executable file not found in %PATH%
```

It is my belief that the sole purpose of these parentheses was to group the commands and that there is no need to run
these commands in a subshell. If so, the change to using braces to group the commands without the creation of a subshell
will have no functional effect on the commands, but will allow the task to run on Windows.
@per1234 per1234 changed the title Make i18n:generate task Windows compatible [skip changelog] Make i18n:generate task Windows compatible Jul 19, 2021
@per1234 per1234 merged commit 8cefc96 into arduino:master Jul 19, 2021
@per1234 per1234 deleted the fix-task branch July 19, 2021 18:32
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 self-assigned this Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows Specific to Windows operating system topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants