]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: Allow us to gather a bit more data when extract.pl dies 9393/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 13 Aug 2021 14:51:22 +0000 (10:51 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 14 Sep 2021 16:56:58 +0000 (12:56 -0400)
When extract.pl dies, it was dieing in a manner that provided
absolutely no useful data as to what went wrong.  Let's add
a tiny bit of debug code.  So we can see what is going wrong.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
vtysh/extract.pl.in

index 86cf8c9657d13eb5bebe2c876a09fef75dbd419e..334bd7affad83f297ce92f1dec9d29ac19c9e210 100755 (executable)
@@ -42,11 +42,13 @@ sub scan_file {
 
     $cppadd = $fabricd ? "-DFABRICD=1" : "";
 
-    open (FH, "@CPP@ -P -std=gnu11 -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @LUA_INCLUDE@ @CPPFLAGS@ @LIBYANG_CFLAGS@ $cppadd $file |");
+    $command_line = "@CPP@ -P -std=gnu11 -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @LUA_INCLUDE@ @CPPFLAGS@ @LIBYANG_CFLAGS@ $cppadd $file |";
+    open (FH, $command_line)
+       || die "Open to the pipeline failed: $!\n\nCommand Issued:\n$command_line";
     local $/; undef $/;
     $line = <FH>;
     if (!close (FH)) {
-       printf "File: $file failed to compile, when extracting cli from it please inspect\n"
+       die "File: $file failed to compile:\n$!\nwhen extracting cli from it please inspect\n"
     }
 
     # ?: makes a group non-capturing