[Tcsh] Patch: Addition: "set noexitifjobs"
Kimmo Suominen
kim at netbsd.org
Fri Feb 24 21:53:27 UTC 2023
Hi Jamie,
I think it would be nice to make this be an extension of ignoreeof.
Maybe setting ignoreeof to -1 could have this behaviour? Or maybe
better yet to extend ignoreeof to parse for multiple values, similar
to savehist?
Presumably you know that you could set ignoreeof=3 to get a warning
about background jobs and to have to press a few extra ^D before the
shell exits.
Cheers,
+ Kimmo
On Fri, 24 Feb 2023 at 15:29, Jamie Landeg-Jones <jamie at catflap.org> wrote:
>
> Whilst I'm here, here is a patch I've been running for a while that
> you may want to add.
>
> If you try to exit the shell and there is a background job running,
> you get the warning "There are suspended jobs.".
>
> This has saved me on many occasions.
>
> The problem is, I'm often connecting through a chain of hosts, so
> to finally exit, I hit CTRL-D a number of times.
>
> Of course, by this time, if I have suspended jobs I've forgotten about,
> it's too late, as the second CTRL-D will terminate the process regardless.
>
> To this end, with this patch, if you set "noexitifjobs" then no amount
> of "exit" / CTRL-D will exit the shell until you either unset "noexitifjobs"
> or close the backgrounded jobs.
>
> If you want to add this patch, I have no emotional attachment to the
> name of the variable I chose - it's functionality I care about - so
> I won't feel slighted if you prefer to use something else!
>
> Cheers, Jamie
>
> --- sh.proc.c.orig 2022-12-13 15:44:04.000000000 +0000
> +++ sh.proc.c 2023-01-03 13:11:31.243229000 +0000
> @@ -1674,7 +1674,9 @@
> {
> struct process *pp;
>
> - chkstop = 2;
> + if (!adrof(STRnoexitifjobs))
> + chkstop = 2;
> +
> for (pp = proclist.p_next; pp; pp = pp->p_next)
> if (pp->p_flags & PSTOPPED)
> stderror(ERR_STOPPED, neednl ? "\n" : "");
> --- tc.const.c.orig 2021-11-01 12:36:38.000000000 +0000
> +++ tc.const.c 2023-01-03 13:11:38.605600000 +0000
> @@ -369,6 +369,7 @@
> Char STRsldotcshrc[] = { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' };
> Char STRsldotlogin[] = { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
> Char STRignoreeof[] = { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
> +Char STRnoexitifjobs[] = { 'n', 'o', 'e', 'x', 'i', 't', 'i', 'f', 'j', 'o', 'b', 's', '\0' };
> Char STRnoclobber[] = { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
> Char STRnotempty[] = { 'n', 'o', 't', 'e', 'm', 'p', 't', 'y', '\0' };
> Char STRask[] = { 'a', 's', 'k', '\0' };
> --- tcsh.man.in.orig 2022-12-17 05:57:50.000000000 +0000
> +++ tcsh.man.in 2023-01-03 13:11:47.318488000 +0000
> @@ -8185,6 +8185,10 @@
> .Ic prompt
> time specifiers at the change of hour.
> .
> +.It Ic noexitifjobs
> +If set, you may not interactively exit the shell if there are suspended jobs
> +associated with it. Close or kill these jobs to allow exiting.
> +.
> .It Ic noglob
> If set,
> .Sx Filename substitution
> --
> Tcsh mailing list
> Tcsh at astron.com
> https://mailman.astron.com/mailman/listinfo/tcsh
More information about the Tcsh
mailing list