Skip to content

Conversation

@steel-bucket
Copy link
Contributor

  • Added Mac compatibility
  • Added Actions which builds and tests the code for Mac.
  • For Mac it was simple, as it's unix based, I just had to make the test_continuous_output_does_not_timeout time to 5 seconds instead of 3.

@steel-bucket steel-bucket changed the title Implemented Github Actions for Mac Implemented Github Actions for Mac and Added Mac Compatibility Apr 1, 2025
src/lib.rs Outdated
result.duration < Duration::from_secs(3),
"Duration should be < 3s"
result.duration < Duration::from_secs(5),
"Duration should be < 5s"
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somehow not running without it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I do some research?

Copy link
Owner

Choose a reason for hiding this comment

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

Should I do some research?

Yes, we can't merge something without understanding what's going on :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay

Copy link
Contributor Author

@steel-bucket steel-bucket Apr 5, 2025

Choose a reason for hiding this comment

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

@cfsmp3 Okay, so I did some research. First I thought that the problem was that "sleep" was taking slightly more time in macos. So I tried with bash and zsh, but they didn't work. Then I tried to perform the timing before the draining, that didn't work. Then I started looking for the functions that may be different for Linux and Mac in the code and not just in the tests. I thought the libc::setpgid would be the difference so I tried replacing it with nix::unistd::setpgid, but that didn't work either, and debugging showed that the duration is unchanged after setpgid.

So now, the thing that I'm almost sure of is that the slight time change originates from the killpg function, so I guess Mac takes slightly more time killing the application.

I've modified the tests for asserting different duration for Linux and Mac. Please suggest any changes.
Thank you.

@steel-bucket steel-bucket reopened this Apr 5, 2025
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