Wez Furlong
dd31d172e9
filedescriptor: 0.8.1 release
2021-08-23 08:59:44 -07:00
Michael Richardson
1d6315e948
helper function to unset cloexec. Use it in redirect_stdio_impl.
2021-08-23 08:56:31 -07:00
Wez Furlong
e046570fa1
fixup build on macos
2021-05-23 14:42:41 -07:00
Wez Furlong
5aa1912a5c
fixup build on windows
2021-05-23 14:34:31 -07:00
Wez Furlong
f78190ec9c
filedescriptor: remove anyhow from public interface
...
Use thiserror instead
2021-05-23 14:24:01 -07:00
Robin Bernon
ed331542ee
Adding ability to redirect std to filedescriptor but only on windows for now
...
Adding unix part of std redirect code. Also modifying existing changes based on feedback from the initial PR.
More changes based on feedback from PR.
Non linux unix OS's forced to use dup2 instead of dup3
Avoiding disposal issues with fd.
Small bit of refactoring plus some more ammendments based on more PR feedback.
Non linux compile issue fix.
Adding return
Another fix
Another fix
More amendments
fmt correction
closes: https://github.com/wez/wezterm/pull/816
closes: https://github.com/wez/wezterm/pull/788
closes: https://github.com/wez/wezterm/issues/786
2021-05-23 13:36:50 -07:00
Wez Furlong
99131a2a98
fixup build on windows, and update tests
2021-03-27 20:40:40 -07:00
Wez Furlong
aae287c4f2
fix filedescriptor::poll on macos
...
Need to use the subsecond microsecond value, rather than the total
microsecond value, otherwise `select(2)` will yield EINVAL.
The wezterm changes show where this error was bubbling up
and breaking the tls client code.
2020-09-10 13:58:14 -07:00
Wez Furlong
180ff0d71a
filedescriptor: drop unused thiserror dep
...
refs: https://github.com/wez/wezterm/pull/186
2020-06-13 09:55:18 -07:00
Wez Furlong
65cc7bb286
filedescriptor: probe for pipes between wsl and win32
...
This is a port of something I found when developing some changes
in watchman. When doing something like:
`some win32 command | wsl something`
That pipe doesn't look like a normal win32 pipe and we'd end up
treating it like a socket, but it isn't really a socket either.
2020-05-09 10:56:53 -07:00
Wez Furlong
8c6819ef63
filedescriptor: macos: mem::uninitialized -> MaybeUninit
...
Move away from the deprecated way of doing this.
2020-01-26 19:07:19 -08:00
Wez Furlong
f3e42c3d2a
point to local filedescriptor crate
2020-01-26 09:15:24 -08:00
Wez Furlong
8f1878c92c
filedescriptor: use winsock send/recv and respect non-blocking mode
2020-01-15 22:55:36 -08:00
Wez Furlong
08b0017c16
add FileDescriptor::set_non_blocking
2020-01-15 08:24:41 -08:00
Wez Furlong
55b4a08131
failure -> anyhow + thiserror
2019-12-14 20:06:25 -08:00
Wez Furlong
b9ae1a709d
fix macos build
2019-07-16 07:09:35 -07:00
Wez Furlong
33933ec523
filedescriptor: probe and remember filetype at construction
...
This avoids a deadlock waiting for the named pipe information to be
returned if we're probing during drop(). This does make the
OwnedHandle struct slightly larger on windows.
2019-07-16 00:27:10 -07:00
Wez Furlong
5f9bb5c3b0
fixup naming and impl for socket traits
2019-06-19 11:26:14 -07:00
Wez Furlong
5ac61ec8d3
expand socket descriptor concept
...
I didn't notice that windows has separate traits for raw sockets,
so blanket impls for things that returned RawHandle's were not
applying on windows in the same way that they were on unix systems.
2019-06-19 11:11:06 -07:00
Wez Furlong
240bc8033c
prep for filedescriptor release
2019-06-18 23:35:53 -07:00
Wez Furlong
56a0de9362
windows: handle broken pipe on read and treat as 0 bytes read
2019-06-18 20:05:47 -07:00
Wez Furlong
ea0d3a0ed1
fixup windows impl
2019-06-18 09:20:17 -07:00
Wez Furlong
9ff22f9c09
add socketpair, with wip on windows
2019-06-18 08:31:27 -07:00
Wez Furlong
f3d201a26b
pull in the poll implementation from wezterm+termwiz
2019-06-18 07:39:24 -07:00
Wez Furlong
2c8e36648b
filedescriptor: fix a silly typo, enhance docs
2019-06-01 08:19:18 -07:00
Wez Furlong
d518c9b2c9
bump filedescriptor crate version to pickup pipe inheritance on windows
2019-05-24 21:26:23 -07:00
Wez Furlong
2e44af7702
filedescriptor: pipes should not be inheritable on windows
2019-05-24 21:26:23 -07:00
Wez Furlong
a9fd318095
prep for publishing filedescriptor to crates.io
2019-05-19 14:27:11 -07:00
Wez Furlong
0d07c1e6b9
F_DUPFD_CLOEXEC is posix, so just assume we have it on unix
2019-05-19 11:57:44 -07:00
Wez Furlong
135a191b57
fix F_DUPFD_CLOEXEC usage
2019-05-19 11:54:05 -07:00
Wez Furlong
ca15d6da1a
explicit comment about not inheriting in DuplicateHandle
2019-05-19 10:53:51 -07:00
Wez Furlong
b4056f6c96
potentially support atomic dup on linux
...
I'm testing this under WSL which doesn't seem to support it,
so I'm committing this so I can try it on a real linux system.
2019-05-19 10:49:09 -07:00
Wez Furlong
32389ee980
use pipe2() for atomic cloexec on linux
2019-05-19 10:09:11 -07:00
Wez Furlong
c0f4e4907d
Tidy up the Pipe interface
2019-05-19 09:39:34 -07:00
Wez Furlong
ee9b5c7a68
add docs for as_stdio
2019-05-19 09:14:40 -07:00
Wez Furlong
143617155e
filedescriptor: add some doc comments
2019-05-19 09:04:47 -07:00
Wez Furlong
0f83309b58
centralize/share some filedescriptor bits
2019-05-19 08:40:38 -07:00
Wez Furlong
ed4a605355
rename FileDescript::fd -> handle on unix
2019-05-19 08:21:35 -07:00
Wez Furlong
9a9fdd5e96
add OwnedHandle concept to the unix flavor of filedescriptor
...
Not strictly needed, but improvess symmetry with the windows flavor.
2019-05-19 08:15:35 -07:00
Wez Furlong
a444047e22
tidy up FileDescriptor safety and interface
2019-05-19 07:51:43 -07:00
Wez Furlong
abdb48469f
tidy up raw handle conversions for filedescriptor
2019-05-19 07:10:31 -07:00
Wez Furlong
c40af4312a
basically functioning on windows
...
(missing some basic builtins like echo though!)
2019-05-18 17:42:01 -07:00
Wez Furlong
9271c130c5
make filedescriptor crate compile on windows
2019-05-18 10:30:28 -07:00
Wez Furlong
8a38ab6cb1
implement pipelines
2019-04-26 21:48:53 -07:00
Wez Furlong
d5cddca18f
plumbing for tracking fds in the shell environment
2019-04-22 22:20:20 -07:00
Wez Furlong
b0d1a56eaa
move filedescriptor to its own crate
2019-04-22 21:20:33 -07:00