hush: job checks and no commands

Denys Vlasenko vda.linux at googlemail.com
Sat Mar 28 22:28:37 UTC 2009


On Saturday 28 March 2009 13:48, Mike Frysinger wrote:
> if you run a job in the background with bash, then simply hitting return for a 
> new prompt will check jobs:
> $ sleep 1 &
> $
> $
> [1] Done		sleep 1
> $
> 
> under hush, jobs are only checked when a command is processed.  so you'd have 
> to do like:
> $ sleep 1 &
> $ :
> $ :
> [1] Done		sleep 1
> $
> 
> how about this simple change ?
> -mike
> 
> --- shell/hush.c	(revision 25852)
> +++ shell/hush.c	(working copy)
> @@ -2771,7 +2771,7 @@ static int run_list(struct pipe *pi)
>  		}
>  #endif
>  		if (pi->num_cmds == 0)
> -			continue;
> +			goto check_jobs_and_continue;
>  
>  		/* After analyzing all keywords and conditions, we decided
>  		 * to execute this pipe. NB: has to do checkjobs(NULL)
> @@ -2858,6 +2858,8 @@ static int run_list(struct pipe *pi)
>  		) {
>  			skip_more_for_this_rword = rword;
>  		}
> +
> + check_jobs_and_continue:
>  		checkjobs(NULL);
>  	} /* for (pi) */

Looks ok.
--
vda


More information about the busybox mailing list