Page MenuHomeFreeBSD

etcupdate: Gracefully handle SIGINT when building trees.
ClosedPublic

Authored by jhb on Apr 19 2021, 9:20 PM.

Details

Summary

Run the 'build_tree' function inside of a subshell and trap SIGINT to
return an error to the caller. This allows callers to gracefully
cleanup a partially created tree.

While here, redirect stdout/stderr of the subshell to the log file
instead of applying redirections individually to each command executed
while building the tree.

MFC after: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb requested review of this revision.Apr 19 2021, 9:20 PM

oh, I think this does what my thought in another review suggested...

This revision is now accepted and ready to land.Apr 19 2021, 9:30 PM
usr.sbin/etcupdate/etcupdate.sh
182

Aren't you trapping SIGINT below? :)

usr.sbin/etcupdate/etcupdate.sh
182

Bah, I fat fingered when I updated this comment.

s/SIGQUIT/SIGINT/ in comment.

This revision now requires review to proceed.Apr 19 2021, 10:38 PM
This revision was not accepted when it landed; it landed in state Needs Review.Apr 20 2021, 8:24 PM
This revision was automatically updated to reflect the committed changes.