Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
ion
Commits
573afbd1
Commit
573afbd1
authored
Aug 23, 2019
by
Jakob Hellermann
Committed by
Michael Aaron Murphy
Jan 12, 2020
Browse files
fix: Split pipe2 into pipe and fcntl on macOS and iOS
Fixes a deprecation warning on these platforms
parent
5d7052ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/shell/pipe_exec/pipes.rs
View file @
573afbd1
...
...
@@ -3,14 +3,24 @@ use super::{
PipelineError
,
};
#[cfg(any(target_os
=
"ios"
,
target_os
=
"macos"
))]
use
nix
::
fcntl
::{
fcntl
,
FcntlArg
};
use
nix
::{
fcntl
::
OFlag
,
unistd
};
use
std
::{
fs
::
File
,
os
::
unix
::
io
::
FromRawFd
};
#[cfg(not(any(target_os
=
"ios"
,
target_os
=
"macos"
)))]
pub
fn
create_pipe
()
->
Result
<
(
File
,
File
),
PipelineError
>
{
let
(
reader
,
writer
)
=
unistd
::
pipe2
(
OFlag
::
O_CLOEXEC
)
.map_err
(
PipelineError
::
CreatePipeError
)
?
;
Ok
(
unsafe
{
(
File
::
from_raw_fd
(
reader
),
File
::
from_raw_fd
(
writer
))
})
}
#[cfg(any(target_os
=
"ios"
,
target_os
=
"macos"
))]
pub
fn
create_pipe
()
->
Result
<
(
File
,
File
),
PipelineError
>
{
let
(
reader
,
writer
)
=
unistd
::
pipe
()
.map_err
(
PipelineError
::
CreatePipeError
)
?
;
fcntl
(
reader
,
FcntlArg
::
F_SETFL
(
OFlag
::
O_CLOEXEC
))
.map_err
(
PipelineError
::
CreatePipeError
)
?
;
fcntl
(
writer
,
FcntlArg
::
F_SETFL
(
OFlag
::
O_CLOEXEC
))
.map_err
(
PipelineError
::
CreatePipeError
)
?
;
Ok
(
unsafe
{
(
File
::
from_raw_fd
(
reader
),
File
::
from_raw_fd
(
writer
))
})
}
pub
struct
TeePipe
<
'a
,
'b
>
{
parent
:
&
'a
mut
RefinedJob
<
'b
>
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment