diff options
-rw-r--r-- | src/graph.cc | 3 | ||||
-rw-r--r-- | src/subprocess-posix.cc | 7 | ||||
-rw-r--r-- | src/subprocess_test.cc | 27 |
3 files changed, 4 insertions, 33 deletions
diff --git a/src/graph.cc b/src/graph.cc index 98a2c18..f1d9ca2 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -37,6 +37,7 @@ bool DependencyScan::RecomputeDirty(Edge* edge, string* err) { edge->outputs_ready_ = true; edge->deps_missing_ = false; + // Load output mtimes so we can compare them to the most recent input below. // RecomputeDirty() recursively walks the graph following the input nodes // of |edge| and the in_edges of these nodes. It uses the stat state of each // node to mark nodes as visited and doesn't traverse across nodes that have @@ -126,8 +127,6 @@ bool DependencyScan::RecomputeOutputsDirty(Edge* edge, Node* most_recent_input, string command = edge->EvaluateCommand(/*incl_rsp_file=*/true); for (vector<Node*>::iterator o = edge->outputs_.begin(); o != edge->outputs_.end(); ++o) { - if (!(*o)->StatIfNecessary(disk_interface_, err)) - return false; if (RecomputeOutputDirty(edge, most_recent_input, command, *o)) { *outputs_dirty = true; return true; diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc index 2ddc709..ae7ae6f 100644 --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -70,11 +70,8 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { break; if (!use_console_) { - // Put the child in its own session and process group. It will be - // detached from the current terminal and ctrl-c won't reach it. - // Since this process was just forked, it is not a process group leader - // and setsid() will succeed. - if (setsid() < 0) + // Put the child in its own process group, so ctrl-c won't reach it. + if (setpgid(0, 0) < 0) break; // Open /dev/null over stdin. diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc index 2fe4bce..c8f2fb8 100644 --- a/src/subprocess_test.cc +++ b/src/subprocess_test.cc @@ -16,8 +16,6 @@ #include "test.h" -#include <string> - #ifndef _WIN32 // SetWithLots need setrlimit. #include <stdio.h> @@ -146,22 +144,11 @@ TEST_F(SubprocessTest, InterruptParentWithSigHup) { ASSERT_FALSE("We should have been interrupted"); } -// A shell command to check if the current process is connected to a terminal. -// This is different from having stdin/stdout/stderr be a terminal. (For -// instance consider the command "yes < /dev/null > /dev/null 2>&1". -// As "ps" will confirm, "yes" could still be connected to a terminal, despite -// not having any of the standard file descriptors be a terminal. -static const char kIsConnectedToTerminal[] = "tty < /dev/tty > /dev/null"; - TEST_F(SubprocessTest, Console) { // Skip test if we don't have the console ourselves. if (isatty(0) && isatty(1) && isatty(2)) { - // Test that stdin, stdout and stderr are a terminal. - // Also check that the current process is connected to a terminal. Subprocess* subproc = - subprocs_.Add(string("test -t 0 -a -t 1 -a -t 2 && ") + - string(kIsConnectedToTerminal), - /*use_console=*/true); + subprocs_.Add("test -t 0 -a -t 1 -a -t 2", /*use_console=*/true); ASSERT_NE((Subprocess*)0, subproc); while (!subproc->Done()) { @@ -172,18 +159,6 @@ TEST_F(SubprocessTest, Console) { } } -TEST_F(SubprocessTest, NoConsole) { - Subprocess* subproc = - subprocs_.Add(kIsConnectedToTerminal, /*use_console=*/false); - ASSERT_NE((Subprocess*)0, subproc); - - while (!subproc->Done()) { - subprocs_.DoWork(); - } - - EXPECT_NE(ExitSuccess, subproc->Finish()); -} - #endif TEST_F(SubprocessTest, SetWithSingle) { |