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

Fixing "run all examples" command for macOS (Contributing page) #61

Closed
wants to merge 2 commits into from

Conversation

MBerguer
Copy link
Contributor

While running this on my machine (Apple silicon mac) I got this:
xargs: command line cannot be assembled, too long

On macOS (and possibly other compatible systems), there is a limit on the size of arguments that can be passed using the -I flag. From the manual page (man xargs):

     -S replsize
             Specify the amount of space (in bytes) that -I can use for
             replacements.  The default for replsize is 255.

So, bumping this number up (e.g. adding -S1024) can resolve this problem.

This change shouldn't affect other architectures, but It would be great if the reviewer could validate this on another setup different than mine.

Motivation

Smoother dev contributing experience (just copy n' paste)

Solution

Adding a flag to the To run all (runnable) examples, specifically to the xargs part of the command.
xargs -S1024 -I {} sh -c 'if cargo run --example {} --quiet 1>/dev/null;

PR Checklist

  • Added Documentation
  • Breaking changes

While running this on my machine (Apple silicon mac) I got this:
`xargs: command line cannot be assembled, too long`

On macOS (and possibly other compatible systems), there is a limit on the size of arguments that can be passed using the "-I" flag. From the manual page (`man xargs`):
```
     -S replsize
             Specify the amount of space (in bytes) that -I can use for
             replacements.  The default for replsize is 255.
```

Bumping this number up (e.g. adding -S1024) can resolve this problem.
@@ -148,7 +148,7 @@ cargo run --example 2>&1 \
-e 'ws_auth' \
-e 'connect_builtin' \
-e 'subscribe_logs' \
| xargs -I {} sh -c 'if cargo run --example {} --quiet 1>/dev/null; then \
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately the -S flag does not exist on Linux, I'll add a Bash script so it can more easily be ran across all operating systems

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I thought this would be easier, but it didn't count with that; let me know if you need help 💪
You can go ahead and close this PR if you plan to open another one or an issue in the future

Copy link
Member

Choose a reason for hiding this comment

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

Closing for now, will think of a better way to enable contributors to run the examples easily. Bash is quite brittle as well.

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