Summary:
The 'test' command uses one equal sign for string equality, not
two. bash apparently is okay with two, but zsh isn't, causing this test
to pass if your shell was bash and fail if it was zsh. The test now
passes with bash, bash in sh mode, zsh, and even dash.
Test Plan:
runtests, also, these pass (zsh failed before):
SHELL=/bin/bash _build/dbg/folly/test/subprocess_test
SHELL=/bin/sh _build/dbg/folly/test/subprocess_test
SHELL=/bin/zsh _build/dbg/folly/test/subprocess_test
SHELL=/bin/dash _build/dbg/folly/test/subprocess_test
Reviewed By: njormrod@fb.com
Subscribers: lins, anca, folly-diffs@
FB internal diff:
D1756090
Signature: t1:
1756090:
1419360674:
8576e61a6e0ee102612c5eae0e1fbd79cc397bfa
}
TEST(CommunicateSubprocessTest, ProcessGroupLeader) {
- const auto testIsLeader = "test $(cut -d ' ' -f 5 /proc/$$/stat) == $$";
+ const auto testIsLeader = "test $(cut -d ' ' -f 5 /proc/$$/stat) = $$";
Subprocess nonLeader(testIsLeader);
EXPECT_THROW(nonLeader.waitChecked(), CalledProcessError);
Subprocess leader(testIsLeader, Subprocess::Options().processGroupLeader());