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

search command in PATH instead of relying on execvpe() #209

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

hanshuebner
Copy link
Contributor

Motivation and Context

execvpe() is not available on macOS

Description

As execvpe() is not available on macOS, implement the PATH search in Rust so that things work on both platforms

How Has This Been Tested?

All tests pass

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@hanshuebner
Copy link
Contributor Author

You can probably see that I'm a Rust beginner, so maybe there is a better way to implement this. I would tend to think that the use of CStrs should really be confined to exec, but at least for the program_name, it seemed to be prudent to parse it into a Rust string so that it can be manipulated before finally turning it into a C string when invoking execve.

Copy link
Owner

@FedericoPonzi FedericoPonzi left a comment

Choose a reason for hiding this comment

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

Added few comments, thanks!

As execvpe() is not available on macOS, implement the PATH search in Rust
so that things work on both platforms
@hanshuebner
Copy link
Contributor Author

I believe I have addressed your concerns. Thank you for your reviews!

@hanshuebner
Copy link
Contributor Author

Looks much better with anyhow!, thank you!

@hanshuebner
Copy link
Contributor Author

Hi @FedericoPonzi,

I'm somewhat confused with the test failure: It seems that the test that is failing is from a previous version but running against the branch version of Horust. This causes a mismatch in parameter count for store_service. Do you know what's happening here? Is anything else needed from my end to merge this?

Thank you!
Hans

@FedericoPonzi
Copy link
Owner

Sorry for the delay as I was AFK other the weekend till today. I'm taking a look at it right now, but I cannot understand what's going on either. It looks like to me that line 92 is fine:

store_service_script(temp_dir.path(), script_first, None, Some("a"));

I will merge it and deal with break on master separately. Thanks!

@FedericoPonzi FedericoPonzi merged commit 969ae13 into FedericoPonzi:master Sep 26, 2023
@hanshuebner
Copy link
Contributor Author

Thank you!

@hanshuebner hanshuebner deleted the macos branch September 26, 2023 15:42
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