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

Windows fixes #2235

Closed
wants to merge 4 commits into from
Closed

Windows fixes #2235

wants to merge 4 commits into from

Conversation

aaron-boxer
Copy link
Contributor

This PR contains a few small fixes to allow setup to run on Windows without erroring out.

@facebook-github-bot
Copy link
Contributor

Hi @aaron-boxer!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@msaroufim msaroufim self-requested a review April 21, 2024 05:35
@msaroufim
Copy link
Member

Assuming CI passes this should be fine to merge, just triggered it now

@DiweiSun
Copy link

DiweiSun commented Apr 28, 2024

Regarding to the os.remove part in init.py, I suppose the temp file cannot be deleted since the file descriptor is not closed yet. Can we try with the following:

   fd, stdout_fpath = tempfile.mkstemp()

    try:
        output_buffer = io.FileIO(stdout_fpath, mode="w")
    except Exception as e:
        return (False, e, io.FileIO(stdout_fpath, mode="r").read().decode())
    finally:
        output_buffer.close()
        del output_buffer
        os.close(fd)
        os.remove(stdout_fpath)

@aaron-boxer
Copy link
Contributor Author

Regarding to the os.remove part in init.py, I suppose the temp file cannot be deleted since the file descriptor is not closed yet. Can we try with the following:

   fd, stdout_fpath = tempfile.mkstemp()

    try:
        output_buffer = io.FileIO(stdout_fpath, mode="w")
    except Exception as e:
        return (False, e, io.FileIO(stdout_fpath, mode="r").read().decode())
    finally:
        output_buffer.close()
        del output_buffer
        os.close(fd)
        os.remove(stdout_fpath)

Thanks, that worked - this is a much better fix.

@boxerab
Copy link

boxerab commented Apr 30, 2024

Assuming CI passes this should be fine to merge, just triggered it now

CI passing now, ready to merge !

Copy link
Contributor

@xuzhao9 xuzhao9 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing it on Windows!

@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@xuzhao9 merged this pull request in 254c5a7.

@aaron-boxer aaron-boxer deleted the windows-fixes branch May 15, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants