{"id":3051,"date":"2013-11-23T01:24:26","date_gmt":"2013-11-23T00:24:26","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=3051"},"modified":"2019-09-03T15:26:18","modified_gmt":"2019-09-03T06:26:18","slug":"dont-trust-pythons-os-execv","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=3051","title":{"rendered":"Don&#8217;t trust python&#8217;s os.execv"},"content":{"rendered":"<p>Python is nice and all, but its low-level functions have real disruptive discrepancies between platforms.<\/p>\n<p>Case at point:<\/p>\n<blockquote>\n<pre>import os\r\nos.execvp(\"sh\", [\"sh\", \"-c\", \"exit 1\"])\r\n<\/pre>\n<\/blockquote>\n<p>As a UNIXy person, I'd expect running the above script to return an error code of 1. And I would be perfectly right... on UNIX systems.<\/p>\n<p>On Windows, it returns 0.<\/p>\n<p>You'd think such a difference in behavior would be documented? It's not.<\/p>\n<p>Thank you python.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python is nice and all, but its low-level functions have real disruptive discrepancies between platforms. Case at point: import os os.execvp(&#8220;sh&#8221;, [&#8220;sh&#8221;, &#8220;-c&#8221;, &#8220;exit 1&#8221;]) As a UNIXy person, I&#8217;d expect running the above script to return an error code of 1. And I would be perfectly right&#8230; on UNIX systems. On Windows, it returns [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,25],"tags":[23],"class_list":["post-3051","post","type-post","status-publish","format-standard","hentry","category-pdo","category-planet-mozilla","tag-en"],"_links":{"self":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3051"}],"version-history":[{"count":2,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3051\/revisions"}],"predecessor-version":[{"id":3053,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3051\/revisions\/3053"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}