All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@citrix.com>
To: George Dunlap <George.Dunlap@citrix.com>
Cc: Nick Rosbrook <rosbrookn@ainfosec.com>,
	xen-devel <xen-devel@lists.xenproject.org>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile
Date: Mon, 8 Jun 2020 12:16:36 +0100	[thread overview]
Message-ID: <24286.7700.36742.982395@mariner.uk.xensource.com> (raw)
In-Reply-To: <5CF4AE1D-C80C-4E4C-B4AA-0779E7DC53E7@citrix.com>

George Dunlap writes ("Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile"):
> \x10So as written this turns out not to work correctly:  `gengotypes.py` spits out syntactically valid but unformatted Go code, and then runs `go fmt` on it to get the right style (including tabs, &c).  But the error code of `go fmt` isn’t checked; so on a system without go installed, if the build system decides it needs to re-run `gengotypes.py` for whatever reason, the build succeeds but the tree ends up “dirtied” with an unformatted version fo the generated text.

And `go fmt' overwrites its input file ?

The lost error is due to using `os.system' which does not raise an
exception.  The python 3 docs for `os.system' say
  | The subprocess module provides more powerful facilities for
  | spawning new processes and retrieving their results; using that
  | module is preferable to using this function. See the Replacing
  | Older Functions with the subprocess Module section in the
  | subprocess documentation for some helpful recipes.
And the recipe suggests
  | sts = os.system("mycmd" + " myarg")
  | # becomes
  | sts = call("mycmd" + " myarg", shell=True)
  | Notes:
  | * Calling the program through the shell is usually not required.
    
This is not particularly helpful advice because subprocess.call, like
os.system, does not raise an exception when things go wrong.  But it
does have a "more realistic example" immediately afterwards which does
actually check the error code.

You wanted subprocess.check_call.  IDK which Python versions have
subprocess.check_call.

Ian.


  parent reply	other threads:[~2020-06-08 11:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 22:16 [PATCH v2 0/5] Golang build fixes / improvements George Dunlap
2020-05-26 22:16 ` [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile George Dunlap
2020-06-04 16:40   ` George Dunlap
2020-06-04 18:29     ` Nick Rosbrook
2020-06-08  9:54       ` George Dunlap
2020-06-08 14:10         ` Nick Rosbrook
2020-06-08 11:16     ` Ian Jackson [this message]
2020-06-08 11:48       ` George Dunlap
2020-05-26 22:16 ` [PATCH v2 2/5] golang/xenlight: Get rid of GOPATH-based build artefacts George Dunlap
2020-05-26 23:57   ` Nick Rosbrook
2020-05-27  0:03   ` Nick Rosbrook
2020-05-26 22:16 ` [PATCH v2 3/5] automation/archlinux: Add 32-bit glibc headers George Dunlap
2020-05-27 10:43   ` Anthony PERARD
2020-05-27 11:29     ` Wei Liu
2020-05-28 11:32       ` George Dunlap
2020-05-29 16:37         ` Anthony PERARD
2020-05-26 22:16 ` [PATCH v2 4/5] automation: Add golang packages to various dockerfiles George Dunlap
2020-05-26 22:16 ` [PATCH v2 5/5] automation/containerize: Add a shortcut for Debian unstable George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24286.7700.36742.982395@mariner.uk.xensource.com \
    --to=ian.jackson@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=rosbrookn@ainfosec.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.