common/mltools: Add a debug statement when we try to run a non-existent program.

Previously:

  $ virt-v2v -v -x -i disk fedora-28.img -o openstack -oo server-id=foo
  virt-v2v: libguestfs 1.39.11fedora=29,release=1.fc29,libvirt (x86_64)
  libvirt version: 4.5.0
  virt-v2v: error: openstack: precheck failed, there may be a problem with
  authentication, see earlier error messages
  rm -rf '/var/tmp/null.dTxRFN'

Notice there is no "earlier error message".

After this commit the error changes to:

  openstack: executable not found
  virt-v2v: error: openstack: precheck failed, there may be a problem with
  authentication, see earlier error messages
This commit is contained in:
Richard W.M. Jones
2018-11-19 19:05:59 +00:00
parent 545147f9be
commit fe9988eff8

View File

@@ -420,9 +420,11 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args =
Either (pid, app, stdout_fd, stderr_fd)
with
| Executable_not_found _ ->
Or 127
| Unix.Unix_error (errcode, _, _) when errcode = Unix.ENOENT ->
Or 127
debug "%s: executable not found" app;
Or 127
| Unix.Unix_error (errcode, fn, _) when errcode = Unix.ENOENT ->
debug "%s: %s: executable not found" app fn;
Or 127
and do_teardown app outfd errfd exitstat =
Option.may Unix.close outfd;