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

Incorrect behaviour of Expect in DESTROY regarding to $! #9

Open
justnoxx opened this issue Jul 26, 2021 · 0 comments
Open

Incorrect behaviour of Expect in DESTROY regarding to $! #9

justnoxx opened this issue Jul 26, 2021 · 0 comments

Comments

@justnoxx
Copy link

Hello!

We have a legacy system that we are moving to the modern perl from older one and we have some issues with Expect on macos.

As you already mentioned in the DESTROY: https://github.com/jacoby/expect.pm/blob/master/lib/Expect.pm#L1844

$? might be affected by syscall. But the same is true for $!. As been said in perlvar :

When referenced, $! retrieves the current value of the C errno integer variable. If $! is assigned a numerical value, that value is stored in errno. When referenced as a string, $! yields the system error string corresponding to errno.
Many system or library calls set errno if they fail, to indicate the cause of failure. They usually do not set errno to zero if they succeed and may set errno to a non-zero value on success. This means errno, hence $!, is meaningful only immediately after a failure

So it is reasonable to store the $! somewhere and then re-assign but I am not sure if this behaviour is correct and this fix is proper.

However, I can prepare the PR for review if it is ok for you.

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

No branches or pull requests

1 participant