[latex3-commits] [git/LaTeX3-latex3-l3build] form-string: Check the boolean value success/fail returned by closing the popen handle. (f0189c2)

David Carlisle d.p.carlisle at gmail.com
Sun Dec 19 15:46:55 CET 2021


Repository : https://github.com/latex3/l3build
On branch  : form-string
Link       : https://github.com/latex3/l3build/commit/f0189c2ff88bec94e71da5e63be52815712ca9a8

>---------------------------------------------------------------

commit f0189c2ff88bec94e71da5e63be52815712ca9a8
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Dec 19 14:46:55 2021 +0000

    Check the boolean value success/fail returned by closing the popen handle.
    
    Throwing an error here means that in principle searching for ERROR in
    the string returned from the CTAN API should not be needed, but leaving that
    code path in as not convinced the http status->curl exit-status->Lua boolean
    mapping will work on all platforms and double checking that a non-error
    result string has the text ERROR can not hurt.


>---------------------------------------------------------------

f0189c2ff88bec94e71da5e63be52815712ca9a8
 CHANGELOG.md       | 5 +++++
 l3build-upload.lua | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15d71a0..6a3f7f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,11 @@ this project uses date-based 'snapshot' version identifiers.
 - use `form-string` rather than `form` for all curl fields to avoid
   misinterpreting leading `@` or `<` eg a description starting `<p>`
   
+- Check the boolean value returned by executing shell commands in
+  l3build-upload and throw an error if this is false. This fixes
+  the issue that previously "validation successful" was reported
+  if curl failed.
+
 ### Changed
 - Documentation of how to validate an upload
 
diff --git a/l3build-upload.lua b/l3build-upload.lua
index 0c1eccb..d6328d6 100644
--- a/l3build-upload.lua
+++ b/l3build-upload.lua
@@ -245,8 +245,12 @@ end
 function shell(s)
   local h = assert(popen(s, 'r'))
   local t = assert(h:read('*a'))
-  h:close()
-  return t
+  local success = h:close()
+  if (success) then
+   return t
+  else
+   error("\nError from shell command:\n" .. s .. "\n" .. t .. "\n")
+  end
 end
 
 function construct_ctan_post(uploadfile,debug)





More information about the latex3-commits mailing list.