summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 4fd8982..07dc675 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -285,6 +285,10 @@ cmd_foreach()
toplevel=$(pwd)
+ # dup stdin so that it can be restored when running the external
+ # command in the subshell (and a recursive call to this function)
+ exec 3<&0
+
module_list |
while read mode sha1 stage path
do
@@ -301,7 +305,7 @@ cmd_foreach()
then
cmd_foreach "--recursive" "$@"
fi
- ) ||
+ ) <&3 3<&- ||
die "Stopping at '$path'; script returned non-zero status."
fi
done