Fix #186: allow continuation character in .conf files

This change makes it possible to use the standard continuation character
in .conf files.  For example:

    service [23456]     \
         log:stderr     \
         <!pid/foo>     \
         bar            \
         -- This is the bar service, it depends on foo # comment that's dropped

Notice the additional support for comments on .conf lines.  If you use
the comment character today you must change to escape it.  Like this:

    service :2 foo -- Foo \#2

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-11-19 10:11:11 +01:00
1 parent f217794773
commit 9046b6fe2b
7 files changed
+85 -30

No files matched your search

+3 -3
View File
@@ -37,9 +37,9 @@ test_add_one()
test_init
test_add_one "task manual:yes name:foo :1 serv -- Foo #1"
test_add_one "task manual:yes name:foo :2 serv -- Foo #2"
test_add_one "task manual:yes name:foo :3 serv -- Foo #3"
test_add_one "task manual:yes name:foo :1 serv -- Foo \#1"
test_add_one "task manual:yes name:foo :2 serv -- Foo \#2"
test_add_one "task manual:yes name:foo :3 serv -- Foo \#3"
test_add_one "task manual:yes name:foobar serv -- Foobar"
say 'Reload Finit'
+11 -4
View File
@@ -19,16 +19,23 @@ test_teardown()
say "Test start $(date)"
say 'Ensure file system is cleared'
texec rm -f /tmp/usr1.log
run "rm -f /tmp/usr1.log"
# Verifies line continuation as well
say "Add service stanza in $FINIT_CONF"
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF"
run "echo 'service [2345] kill:20 \\
log service.sh \\
-- Test service' > $FINIT_CONF"
run "cat $FINIT_CONF"
#run "initctl debug"
say 'Reload Finit'
texec sh -c "initctl reload"
run "initctl reload"
#run "initctl status service.sh"
say 'Send SIGUSR1 to service...'
texec sh -c "initctl signal service.sh SIGUSR1"
run "initctl signal service.sh SIGUSR1"
# shellcheck disable=SC2016
retry 'assert "service.sh received SIGUSR" "$(texec cat /tmp/usr1.log)" = "USR1"' 10 1