diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-08-13 10:51:22 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-09-14 12:56:58 -0400 |
| commit | b504f65bafa5f5c27ce770263ced9ed8959bc62f (patch) | |
| tree | 2db0e421d643a719f8d23f97df181c66073e09a5 | |
| parent | 2a8ded2b97b578a98ce4805d2d57e785f2acd0ac (diff) | |
vtysh: Allow us to gather a bit more data when extract.pl dies
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>
| -rwxr-xr-x | vtysh/extract.pl.in | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 86cf8c9657..334bd7affa 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -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 |
