This repository has been archived by the owner on May 4, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
unix: allow specifying FDs to be inherited by a child process
Previously the only option was to create a pipe or an ipc channel. This patch makes it possible to inherit a handle that is already open in the parent process. It also makes it possible to set more than just stdin, stdout and stderr.
- Loading branch information
1 parent
5a34f19
commit c0081f0
Showing
4 changed files
with
125 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,4 +159,4 @@ BENCHMARK_IMPL(spawn) { | |
(double) N / (double) (end_time - start_time) * 1000.0); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -617,4 +617,4 @@ int ipc_helper_tcp_connection() { | |
ASSERT(close_cb_called == 4); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -759,4 +759,4 @@ TEST_IMPL(spawn_setgid_fails) { | |
|
||
return 0; | ||
} | ||
#endif | ||
#endif |
c0081f0
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.
After this change, libuv always seems to use socketpair(2) instead of pipe2(2) to create the "pipe"s to communicate with child processes (eg, in Node child_process).
What was the reason for this choice?
Specifically, this breaks the ability to open "/dev/stdin" (etc) or "/proc/self/fd/0" in the child process, since these don't seem to work on socketpair-created fds.
c0081f0
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.
For the record, I've answered Dave's question here: http://groups.google.com/group/nodejs/browse_thread/thread/4b134a2dc95b3399