From 3019c48804fb43f97d5c8e8ee15b5ae13ab1c4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 9 Jul 2021 15:32:09 +0200 Subject: Use set -e, -x in shell process, handle exit status correctly This makes the default behavior like make(1), but it is configurable. Furthermore, it is still a single shell process, which is arguably a benefit. --- build.1 | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'build.1') diff --git a/build.1 b/build.1 index cf66324..10ae999 100644 --- a/build.1 +++ b/build.1 @@ -77,17 +77,9 @@ This means that you can keep state across multiple commands. Note that all commands are executed regardless of the exit status of previous commands. .Pp +If a command fails, .Nm -exits with a positive status if a command failed. -Note that it checks the status -of the entire command sent to the shell, -not the individual command lines. -To emulate the behavior of -.Xr make 1 , -which fails if any individual command line fails, -you can use -.Ql set -e -in your command line. +exits with a positive status and aborts the build process. . .Sh EXAMPLES .Pp @@ -120,8 +112,8 @@ Assuming that the file starts with the following text, .Bd -literal -offset indent \&.\\" This document is built with the following shell commands: -\&.\\" $ refer -p refs doc.t | troff -ms | dpost > doc.ps && -\&.\\" $ ps2pdf doc.ps > doc.pdf && +\&.\\" $ refer -p refs doc.t | troff -ms | dpost > doc.ps +\&.\\" $ ps2pdf doc.ps > doc.pdf \&.\\" $ rm doc.ps \&. \&.\\" Apart from this file, it depends on the following files: -- cgit v1.2.3