From 9d2092bf9fa65450bb8a021c4ecd42af1b7bf11b Mon Sep 17 00:00:00 2001 From: Corey Ford Date: Wed, 8 Jun 2016 16:09:29 -0700 Subject: [PATCH] don't print header for each job --- src/builtin_jobs.cpp | 2 +- tests/jobs.err | 0 tests/jobs.in | 3 +++ tests/jobs.out | 3 +++ tests/jobs.status | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/jobs.err create mode 100644 tests/jobs.in create mode 100644 tests/jobs.out create mode 100644 tests/jobs.status diff --git a/src/builtin_jobs.cpp b/src/builtin_jobs.cpp index 406795aa3..f5f7a0592 100644 --- a/src/builtin_jobs.cpp +++ b/src/builtin_jobs.cpp @@ -204,7 +204,7 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) { while ((j = jobs.next())) { // Ignore unconstructed jobs, i.e. ourself. if ((j->flags & JOB_CONSTRUCTED) && !job_is_completed(j)) { - builtin_jobs_print(j, mode, !streams.out_is_redirected, streams); + builtin_jobs_print(j, mode, !found && !streams.out_is_redirected, streams); found = 1; } } diff --git a/tests/jobs.err b/tests/jobs.err new file mode 100644 index 000000000..e69de29bb diff --git a/tests/jobs.in b/tests/jobs.in new file mode 100644 index 000000000..c32b9b376 --- /dev/null +++ b/tests/jobs.in @@ -0,0 +1,3 @@ +sleep 1 & +sleep 1 & +jobs -c diff --git a/tests/jobs.out b/tests/jobs.out new file mode 100644 index 000000000..702f017fa --- /dev/null +++ b/tests/jobs.out @@ -0,0 +1,3 @@ +Command +sleep +sleep diff --git a/tests/jobs.status b/tests/jobs.status new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/jobs.status @@ -0,0 +1 @@ +0