Skip to content

Commit

Permalink
Merge pull request #1658 from chu11/issue1331-cleanup2
Browse files Browse the repository at this point in the history
re-define flux_subprocess_destroy prototype
  • Loading branch information
grondo authored Sep 13, 2018
2 parents b7b5e18 + 680473a commit 5435246
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 7 additions & 1 deletion src/cmd/flux-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ static void signal_cb (int signum)
}
}

void subprocess_destroy (void *arg)
{
flux_subprocess_t *p = arg;
flux_subprocess_destroy (p);
}

int main (int argc, char *argv[])
{
const char *optargp;
Expand Down Expand Up @@ -302,7 +308,7 @@ int main (int argc, char *argv[])
log_err_exit ("flux_rexec");
if (zlist_append (subprocesses, p) < 0)
log_err_exit ("zlist_append");
if (!zlist_freefn (subprocesses, p, flux_subprocess_destroy, true))
if (!zlist_freefn (subprocesses, p, subprocess_destroy, true))
log_err_exit ("zlist_freefn");
}

Expand Down
6 changes: 0 additions & 6 deletions src/common/subprocess/subprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,12 +937,6 @@ void flux_subprocess_unref (flux_subprocess_t *p)
}
}

void flux_subprocess_destroy (void *arg)
{
flux_subprocess_t *p = arg;
flux_subprocess_unref (p);
}

flux_subprocess_state_t flux_subprocess_state (flux_subprocess_t *p)
{
if (!p || p->magic != SUBPROCESS_MAGIC) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/subprocess/subprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ flux_future_t *flux_subprocess_kill (flux_subprocess_t *p, int signo);
*/
void flux_subprocess_ref (flux_subprocess_t *p);
void flux_subprocess_unref (flux_subprocess_t *p);
void flux_subprocess_destroy (void *arg);
#define flux_subprocess_destroy(x) flux_subprocess_unref(x)

/* Return current state value of subprocess. Note this may differ
* than state returned in on_state_change callback, as a subprocess
Expand Down
6 changes: 3 additions & 3 deletions t/t0005-rexec.t
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,23 @@ test_expect_success 'rexec check channel FD created' '
grep "TEST_CHANNEL_FD=" output
'

# execbasic does not close TEST_CHANNEL, so we tell test_echo max
# rexec does not close TEST_CHANNEL, so we tell test_echo max
# bytes we're feeding in
test_expect_success 'rexec channel input' '
echo -n "foobar" | ${FLUX_BUILD_DIR}/t/rexec/rexec -i TEST_CHANNEL ${TEST_SUBPROCESS_DIR}/test_echo -c TEST_CHANNEL -P -O -b 6 > output 2>&1 &&
echo "STDOUT:foobar" > expected &&
test_cmp expected output
'

# execbasic does not close TEST_CHANNEL, so we tell test_echo max
# rexec does not close TEST_CHANNEL, so we tell test_echo max
# bytes we're feeding in
test_expect_success 'rexec channel input and output' '
echo -n "foobaz" | ${FLUX_BUILD_DIR}/t/rexec/rexec -i TEST_CHANNEL ${TEST_SUBPROCESS_DIR}/test_echo -c TEST_CHANNEL -P -C -b 6 > output 2>&1 &&
echo "TEST_CHANNEL:foobaz" > expected &&
test_cmp expected output
'

# execbasic does not close TEST_CHANNEL, so we tell test_echo max
# rexec does not close TEST_CHANNEL, so we tell test_echo max
# bytes we're feeding in
test_expect_success 'rexec channel input and output multiple lines' '
/bin/echo -en "foo\nbar\nbaz\n" | ${FLUX_BUILD_DIR}/t/rexec/rexec -i TEST_CHANNEL ${TEST_SUBPROCESS_DIR}/test_echo -c TEST_CHANNEL -C -n -b 6 > output 2>&1 &&
Expand Down

0 comments on commit 5435246

Please sign in to comment.