commit:     505af695d8bebdf468ada0899931554b31b4d22c
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Jan 20 17:19:01 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 22:45:56 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=505af695

openrc-run: in verbose mode, log execution of the shell script

This is to show when openrc-run runs the openrc-run.sh script; it is
used for debugging.

 src/rc/openrc-run.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/rc/openrc-run.c b/src/rc/openrc-run.c
index 757412a..2a4b90d 100644
--- a/src/rc/openrc-run.c
+++ b/src/rc/openrc-run.c
@@ -390,6 +390,14 @@ svc_exec(const char *arg1, const char *arg2)
                }
 
                if (exists(RC_SVCDIR "/openrc-run.sh")) {
+                       if (arg2)
+                               einfov("Executing: %s %s %s %s %s",
+                                       RC_SVCDIR "/openrc-run.sh", RC_SVCDIR 
"/openrc-run.sh",
+                                       service, arg1, arg2);
+                       else
+                               einfov("Executing: %s %s %s %s",
+                                       RC_SVCDIR "/openrc-run.sh", RC_SVCDIR 
"/openrc-run.sh",
+                                       service, arg1);
                        execl(RC_SVCDIR "/openrc-run.sh",
                            RC_SVCDIR "/openrc-run.sh",
                            service, arg1, arg2, (char *) NULL);
@@ -397,6 +405,16 @@ svc_exec(const char *arg1, const char *arg2)
                            service, strerror(errno));
                        _exit(EXIT_FAILURE);
                } else {
+                       if (arg2)
+                               einfov("Executing: %s %s %s %s %s",
+                                       RC_LIBEXECDIR "/sh/openrc-run.sh",
+                                       RC_LIBEXECDIR "/sh/openrc-run.sh",
+                               service, arg1, arg2);
+                       else
+                               einfov("Executing: %s %s %s %s",
+                                       RC_LIBEXECDIR "/sh/openrc-run.sh",
+                                       RC_LIBEXECDIR "/sh/openrc-run.sh",
+                               service, arg1);
                        execl(RC_LIBEXECDIR "/sh/openrc-run.sh",
                            RC_LIBEXECDIR "/sh/openrc-run.sh",
                            service, arg1, arg2, (char *) NULL);

Reply via email to