-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
os: expose guessFileDescriptorType
#58060
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
base: main
Are you sure you want to change the base?
os: expose guessFileDescriptorType
#58060
Conversation
I'll rebase to fix the first commit message after the CI passes! Should I also squash the PR or leave the rest as is? |
As you prefer, in any case it will get squashed upon merging. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58060 +/- ##
==========================================
- Coverage 90.21% 90.21% -0.01%
==========================================
Files 630 630
Lines 186391 186392 +1
Branches 36608 36619 +11
==========================================
- Hits 168161 168156 -5
- Misses 11052 11060 +8
+ Partials 7178 7176 -2
🚀 New features to boost your workflow:
|
b88d406
to
f3d0b71
Compare
doc/api/os.md
Outdated
added: REPLACEME | ||
--> | ||
|
||
* `handle` {integer} The handle number to try and guess the type of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really specify that "handle" means "file descriptor". In fact, given that the fs docs almost exclusively use "file descriptor" and "fd", I would also adopt that terminology here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I could also rename the function to guessFileDescriptorType
? Or should I leave it as is?
And will apply the changes to fd/file descriptor in a few
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd probably do that. In the context of libuv, guessHandleType
makes more sense, because it returns a value that actually corresponds to the types of libuv handles, which wrap around fds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Let me know if I've also done the rebase correctly 🤞
guessHandleType
guessFileDescriptorType
f3d0b71
to
0c33ea7
Compare
Exposes the internal `guessHandleType` function as `guessFileDescriptorType`, which can be used to see if a handle has a specific type, regardless of the OS it is on. This helps out with detecting, for example, if standard input is piped into the process, instead of relying on file system calls. Refs: nodejs#57603
0c33ea7
to
93dc673
Compare
proxy->GetTarget(), | ||
proxy->GetHandler() | ||
}; | ||
Local<Value> ret[] = {proxy->GetTarget(), proxy->GetHandler()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a large number of unrelated changes in here. Were these manually edited or did the format tool do these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the formatting changes were done by saving the file (after configuring vscode with the settings example provided by the contributing guide). Not sure exactly why so many changes happened, but running the cpp formatter through make also didn't revert it. I can manually revert it if desired
Co-authored-by: James M Snell <[email protected]>
Exposes the internal
guessHandleType
function, which can be used to see if a handle has a specific type, regardless of the OS it is on.This helps out with detecting, for example, if standard input is piped into the process, instead of relying on file system calls.
Refs: #57603