Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
e648d289
Commit
e648d289
authored
May 03, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FileDescriptor::pipe.
parent
8214a5ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
test/gtest-extra.cc
test/gtest-extra.cc
+15
-7
test/gtest-extra.h
test/gtest-extra.h
+1
-1
No files found.
test/gtest-extra.cc
View file @
e648d289
...
...
@@ -95,17 +95,25 @@ void FileDescriptor::dup2(int fd, ErrorCode &ec) FMT_NOEXCEPT(true) {
ec
=
ErrorCode
(
errno
);
}
void
FileDescriptor
::
pipe
(
FileDescriptor
&
read
,
FileDescriptor
&
write
)
{
void
FileDescriptor
::
pipe
(
FileDescriptor
&
read
_fd
,
FileDescriptor
&
write_fd
)
{
// Close the descriptors first to make sure that assignments don't throw
// and there are no leaks.
read
.
close
();
write
.
close
();
read
_fd
.
close
();
write
_fd
.
close
();
int
fds
[
2
]
=
{};
if
(
::
pipe
(
fds
)
!=
0
)
#ifdef _WIN32
// Make the default pipe capacity same as on Linux 2.6.11+.
enum
{
DEFAULT_CAPACITY
=
65536
};
int
result
=
_pipe
(
fds
,
DEFAULT_CAPACITY
,
_O_BINARY
);
#else
int
result
=
::
pipe
(
fds
);
#endif
if
(
result
!=
0
)
fmt
::
ThrowSystemError
(
errno
,
"cannot create pipe"
);
// The following assignments don't throw because read and write are closed.
read
=
FileDescriptor
(
fds
[
0
]);
write
=
FileDescriptor
(
fds
[
1
]);
// The following assignments don't throw because read_fd and write_fd
// are closed.
read_fd
=
FileDescriptor
(
fds
[
0
]);
write_fd
=
FileDescriptor
(
fds
[
1
]);
}
OutputRedirector
::
OutputRedirector
(
FILE
*
file
)
:
file_
(
file
)
{
...
...
test/gtest-extra.h
View file @
e648d289
...
...
@@ -204,7 +204,7 @@ class FileDescriptor {
// Creates a pipe setting up read and write file descriptors for reading
// and writing respecively. Throws fmt::SystemError on error.
static
void
pipe
(
FileDescriptor
&
read
,
FileDescriptor
&
write
);
static
void
pipe
(
FileDescriptor
&
read
_fd
,
FileDescriptor
&
write_fd
);
};
#if !FMT_USE_RVALUE_REFERENCES
...
...
Write
Preview
Markdown
is supported
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