Skip to content

[Bug] File descriptors aren't supported in the FS layer #359

@arcanis

Description

@arcanis

Describe the bug

Our FS layer doesn't support file descriptors at the moment, which causes issues in some cases (particularly ESLint).

To fix that, we need to:

  • Create a new type in path.ts, FSPath<T>, which is T | number
  • Use FSPath<NativePath> in the fs functions that accepts file descriptors
  • Update ProxiedFS to accept/return a FSPath<T> instead of Path
  • Update ProxiedFS to not call mapFromBase / mapToBase on fds

To Reproduce

const {openSync, readFileSync, writeFileSync} = require(`fs`);

writeFileSync(`foo`, `hello world`);
const fd = openSync(`foo`, `r`);

expect(() => readFileSync(fd)).not.toThrow();

Additional context

Ref SublimeLinter/SublimeLinter#1644

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreproducibleThis issue can be successfully reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions