Page MenuHomeFreeBSD

periodic: replace "tty" with "test -t 0"
ClosedPublic

Authored by asomers on Aug 18 2019, 5:24 PM.

Details

Summary

periodic: replace "tty" with "test -t 0"

Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Diff Detail

Repository
rS 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

asomers created this revision.Aug 18 2019, 5:24 PM
cy requested changes to this revision.Aug 18 2019, 6:41 PM
cy added inline comments.
usr.sbin/periodic/periodic.sh
87 ↗(On Diff #60971)

can this be if [ -t 0] ?

test fork()s and exec()s a new process whereas [ performs the test within the shell, saving a fork() & exec().

This revision now requires changes to proceed.Aug 18 2019, 6:41 PM
asomers updated this revision to Diff 60975.Aug 18 2019, 8:44 PM

Use [ instead of test

cy added a comment.Aug 18 2019, 9:06 PM

Thanks. LGTM.

usr.sbin/periodic/periodic.sh
89 ↗(On Diff #60975)

Sorry for missing this before but there is nothing between this else end endif. Did you mean

export PERIODIC_IS_INTERACTIVE=0

or unset PERIODIC_IS_INTERACTIVE

asomers added inline comments.Aug 18 2019, 11:49 PM
usr.sbin/periodic/periodic.sh
89 ↗(On Diff #60975)

Oh, crap, I meant to delete that. It was only there for debugging purposes.

asomers updated this revision to Diff 60980.Aug 18 2019, 11:49 PM

Remove debugging detritus

cy accepted this revision.Aug 19 2019, 1:09 AM

LGTM

This revision is now accepted and ready to land.Aug 19 2019, 1:09 AM
This revision was automatically updated to reflect the committed changes.