summaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'job.c')
-rw-r--r--job.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/job.c b/job.c
index fcdd2f1..7a77481 100644
--- a/job.c
+++ b/job.c
@@ -1274,11 +1274,16 @@ new_job (file)
c->sh_batch_file = NULL;
/* Fetch the first command line to be run. */
- job_next_command (c);
-
- /* The job is now primed. Start it running.
- (This will notice if there are in fact no commands.) */
- (void)start_waiting_job (c);
+ if (job_next_command (c))
+ /* The job is now primed. Start it running. */
+ (void)start_waiting_job (c);
+ else
+ {
+ /* There were no commands (variable expands to empty?). All done. */
+ c->file->update_status = 0;
+ notice_finished_file(c->file);
+ free_child (c);
+ }
if (job_slots == 1)
/* Since there is only one job slot, make things run linearly.