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

refactor: wrap all dart:io calls #568

Merged
merged 1 commit into from Nov 15, 2023
Merged

refactor: wrap all dart:io calls #568

merged 1 commit into from Nov 15, 2023

Conversation

XavierChanth
Copy link
Member

@XavierChanth XavierChanth commented Nov 15, 2023

- What I did

Wrapped all io calls:

  • Processes have typedefs which can be replaced with a mocked function
  • File system calls are now using the file package which allows for the use of LocalFileSystem by default, but a MemoryFileSystem (i.e. an in memory file system) for testing purposes
  • Platform is exported from the io_types file to ensure that it's easy to catch any leakage of dart:io into the rest of the library

Note: I left the dart:io call in SshnpDartInitialTunnelHandler since that code needs some discussion before it can be properly addressed. (I'd like to remove all io calls from that tunnel handler altogether, which means changing some of the overall functionality)

  • Moved findLocalPortIfRequired from SshnpCore to SshnpOpensshLocalImpl since it depends on SecureSockets, if we find a need to expose this to other implementations later, we can move it to a mixin or something later.

- How I did it

- How to verify it

- Description for the changelog
refactor: wrap all dart:io calls

Copy link
Contributor

@gkc gkc left a comment

Choose a reason for hiding this comment

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

LGTM; please can you also update the PR description with some info about the refactoring of findLocalPortIfRequired

@XavierChanth
Copy link
Member Author

LGTM; please can you also update the PR description with some info about the refactoring of findLocalPortIfRequired

Forgot I moved that, good catch

@XavierChanth XavierChanth merged commit aca13fd into trunk Nov 15, 2023
11 checks passed
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.

None yet

2 participants