rc(1) exec failure handling

Fri, 29 Jan 2016 00:19:23 EST
BurnZeZ@[REDACTED]

First, two examples.

term% rc >[2=1] | xd -c exec foo; echo should this happen 0000000 t e r m % f o o : ‘ . / f o 0000010 o ’ d i r e c t o r y e n t 0000020 r y n o t f o u n d \n s h o 0000030 u l d t h i s h a p p e n \n 0000040 t e r m %
0000046

term% rc -c ‘exec foo; echo objection!’ foo: ‘./foo’ directory entry not found objection! rc: /rc/lib/rcmain:29: token EOF: syntax error

rc does indeed exit when exec fails, and it may be argued that it may intended for the following command to be executed.

For example, ‘exec foo; exec bar’ might be used to define an explicit fallback. (Whether using || or ; does not seem to matter.)

However, it should be noted that it prints $prompt(1) before exiting when an additional command has been passed and rc is interactive, which seems to me like some code paths may not have been fully worked out. (The second example seems to further imply this.)


Mon, 28 Mar 2016 15:14:45 EDT sl

rc will now terminate and set error status