Dan Burkert has posted comments on this change. Change subject: Add option to set CWD to Subprocess ......................................................................
Patch Set 2: (7 comments) http://gerrit.cloudera.org:8080/#/c/7176/2/src/kudu/util/subprocess-test.cc File src/kudu/util/subprocess-test.cc: PS2, Line 140: Test that environment variables can be passed to the subprocess > stale comment? Done Line 147: p.SetCurrentDir(DirName(kTestFilePath)); > I imagine the cwd of a gtest isn't the same as GetTestPath(""), but just in Done PS2, Line 150: FILE* in = fdopen(p.from_child_stdout_fd(), "r"); : PCHECK(in); : char buf[1024]; : ASSERT_EQ(buf, fgets(buf, sizeof(buf), in)); : ASSERT_STREQ("foo\n", &buf[0]); : ASSERT_OK(p.Wait()); > Does the output of ls actually matter? How about just using p.GetExitStatus Done http://gerrit.cloudera.org:8080/#/c/7176/2/src/kudu/util/subprocess.cc File src/kudu/util/subprocess.cc: Line 426: PLOG(ERROR) << "Unable to set subprocess current directory to " << cwd_; > I think PCHECK() would be net fewest lines of code. We already use it on L4 Done Line 693: void Subprocess::SetEnvVars(std::map<string, string> env) { > Nit: could you drop the std:: prefix from map too? Done Line 697: void Subprocess::SetCurrentDir(string cwd) { > We should check that the subprocess hasn't yet started. Same goes for SetEn Done http://gerrit.cloudera.org:8080/#/c/7176/2/src/kudu/util/subprocess.h File src/kudu/util/subprocess.h: PS2, Line 80: SetCurrentDir > Agreed that setting it at construction time would be nice; then cwd_ could It's already somewhat of a builder for itself, there are already a bunch of options that can only be set by constructing it first, setting them, then starting it. -- To view, visit http://gerrit.cloudera.org:8080/7176 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73dc4983b0074312623790ce026e6ad88439df89 Gerrit-PatchSet: 2 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Dan Burkert <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Andrew Wong <[email protected]> Gerrit-Reviewer: Dan Burkert <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Tidy Bot Gerrit-HasComments: Yes
