Skip to contentSkip to conversation

run-ptest: use error handling for useradd and userdel

PATCH New Aditya Tayade 1 participant 1 message Mar 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 run-ptest: use error handling for useradd and userdel

Error handling in shell scripts is too easy to forget and get wrong. It is possible to check every external command for return values but it is better to use a generic setting which halts execution of the script on any failures.

Upstream-Status: Pending

---
 meta/recipes-core/glib-2.0/glib-2.0/run-ptest | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/glib-2.0/glib-2.0/run-ptest +1 -0
index 5b85e8f..8f082d3 100644
@@ -1,5 +1,6 @@
 #! /bin/sh
 
+set -eux
 useradd glib2-test
 su glib2-test -c gnome-desktop-testing-runner glib
 userdel glib2-test

--
2.7.4

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.