[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile
George Dunlap writes ("Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile"): > So 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.
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |