9abf2388f24 rewrote "sh -c cat" as SHELL "-c cat", which concatenates
to "/bin/sh-c cat", so the subshell tries to execute a non-existent
"/bin/sh-c". The test still passed because the SIGTERM sent by kill()
usually wins the race against the shell startup; under CI load the
shell occasionally prints
/bin/sh: line 1: /bin/sh-c: No such file or directory
into the stderr pipe first, ASSERT_TRUE(buf.empty()) fails, and the
skipped join() turns this into a SIGABRT in ~SubProcess().
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
TEST(SubProcessTimed, SubshellKilled)
{
SubProcessTimed sh(SHELL, SubProcess::PIPE, SubProcess::PIPE, SubProcess::PIPE, 10);
- sh.add_cmd_args("-c", SHELL "-c cat", NULL);
+ sh.add_cmd_args("-c", SHELL " -c cat", NULL);
ASSERT_EQ(sh.spawn(), 0);
std::string msg("etaoin shrdlu");
int n = write(sh.get_stdin(), msg.c_str(), msg.size());