Skip to content
Snippets Groups Projects
Commit 450b8729 authored by Jani Nikula's avatar Jani Nikula
Browse files

dim: do not do local variable assignments in declaration

We rely on 'set -e' to bail out on errors. We also do a lot of local
variable assignments with command substitution like this:

	local foo=$(bar)

However, that masks the return value of the command, failing to bail out
on errors. Split up local variable declarations from assignments to
avoid the problems.

There are no issues with literal assignments like

	local foo="bar"

but split those out too for more uniform code, preferring to have local
declarations in the beginning of functions or nested blocks.

Details at
http://stackoverflow.com/questions/4421257/why-does-local-sweep-the-return-code-of-a-command



Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 88f01383
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment