[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
76/118: nix-daemon: Simplify stderr handling
From: |
Ludovic Courtès |
Subject: |
76/118: nix-daemon: Simplify stderr handling |
Date: |
Tue, 19 May 2015 14:45:47 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit bb07dfe96f0d07aa18db385d3ec93b24b5568213
Author: Eelco Dolstra <address@hidden>
Date: Wed Jul 23 19:37:40 2014 +0200
nix-daemon: Simplify stderr handling
---
nix/libutil/util.cc | 1 +
nix/nix-daemon/nix-daemon.cc | 8 +-------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 32244b2..aa9d99e 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -850,6 +850,7 @@ pid_t startProcess(std::function<void()> fun, const string
& errorPrefix)
if (pid == -1) throw SysError("unable to fork");
if (pid == 0) {
+ _writeToStderr = defaultWriteToStderr;
try {
restoreAffinity();
fun();
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index f2141ee..ed3febd 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -48,7 +48,6 @@ static FdSource from(STDIN_FILENO);
static FdSink to(STDOUT_FILENO);
bool canSendStderr;
-pid_t myPid;
@@ -58,11 +57,7 @@ pid_t myPid;
socket. */
static void tunnelStderr(const unsigned char * buf, size_t count)
{
- /* Don't send the message to the client if we're a child of the
- process handling the connection. Otherwise we could screw up
- the protocol. It's up to the parent to redirect stderr and
- send it to the client somehow (e.g., as in build.cc). */
- if (canSendStderr && myPid == getpid()) {
+ if (canSendStderr) {
try {
writeInt(STDERR_NEXT, to);
writeString(buf, count, to);
@@ -663,7 +658,6 @@ static void performOp(bool trusted, unsigned int
clientVersion,
static void processConnection(bool trusted)
{
canSendStderr = false;
- myPid = getpid();
_writeToStderr = tunnelStderr;
#ifdef HAVE_HUP_NOTIFICATION
- 60/118: Make dev-shell script work on Darwin, (continued)
- 60/118: Make dev-shell script work on Darwin, Ludovic Courtès, 2015/05/19
- 71/118: Revert old useBuildHook behaviour, Ludovic Courtès, 2015/05/19
- 63/118: Get rid of a compiler warning, Ludovic Courtès, 2015/05/19
- 67/118: nix-daemon: Add trusted-users and allowed-users options, Ludovic Courtès, 2015/05/19
- 70/118: Better fix for strcasecmp on Darwin, Ludovic Courtès, 2015/05/19
- 75/118: Merge commit 'fdee1ced43fb495d612a29e955141cdf6b9a95ba' into nix, Ludovic Courtès, 2015/05/19
- 74/118: Merge commit '8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74' into nix, Ludovic Courtès, 2015/05/19
- 73/118: startProcess: Make writing error messages from the child more robust, Ludovic Courtès, 2015/05/19
- 69/118: Bump, Ludovic Courtès, 2015/05/19
- 86/118: Add option ‘build-extra-chroot-dirs’, Ludovic Courtès, 2015/05/19
- 76/118: nix-daemon: Simplify stderr handling,
Ludovic Courtès <=
- 77/118: nix-daemon: Less verbosity, Ludovic Courtès, 2015/05/19
- 90/118: Remove unnecessary call to addTempRoot(), Ludovic Courtès, 2015/05/19
- 88/118: Move some options out of globals, Ludovic Courtès, 2015/05/19
- 83/118: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/05/19
- 84/118: Remove ugly hack for detecting build environment setup errors, Ludovic Courtès, 2015/05/19
- 85/118: Get rid of "killing <pid>" message for unused build hooks, Ludovic Courtès, 2015/05/19
- 93/118: Reduce verbosity, Ludovic Courtès, 2015/05/19
- 92/118: Propagate remote timeouts properly, Ludovic Courtès, 2015/05/19
- 87/118: Refactor, Ludovic Courtès, 2015/05/19
- 79/118: Allow regular files as GC roots, Ludovic Courtès, 2015/05/19