From mboxrd@z Thu Jan 1 00:00:00 1970 From: daimrod@omecha.info (=?utf-8?Q?Gr=C3=A9goire?= Jadi) Subject: [PATCH] ox-taskjuggler.el: Check return code instead of error buffer Date: Fri, 18 May 2018 10:36:04 +0200 Message-ID: <87d0xtqs23.fsf@omecha.info> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJas5-0003eD-Qf for emacs-orgmode@gnu.org; Fri, 18 May 2018 04:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJas2-000523-O3 for emacs-orgmode@gnu.org; Fri, 18 May 2018 04:36:17 -0400 Received: from a.omecha.info ([89.234.176.136]:42770 helo=omecha.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJas2-0004zg-EC for emacs-orgmode@gnu.org; Fri, 18 May 2018 04:36:14 -0400 Received: from puffy.omecha.info (unknown [192.168.99.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by omecha.info (Postfix) with ESMTPSA id ECF751A5 for ; Fri, 18 May 2018 10:36:11 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello orgmode@, I've recently tried taskjuggler and it reports some warnings about Fixnum: https://github.com/taskjuggler/TaskJuggler/issues/200 However, this warnings do not prevent taskjuggler from exporting a report. This patch checks the return code instead of the error buffer to determine if the export process was successful or not. WDYT? Best, --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-taskjuggler.el-Check-return-code-instead-of-error.patch Content-Transfer-Encoding: quoted-printable From=207113e79ef8a9cd476873d278e1a4124be2f20f12 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Gr=3DC3=3DA9goire=3D20Jadi?=3D Date: Fri, 18 May 2018 10:30:38 +0200 Subject: [PATCH] ox-taskjuggler.el: Check return code instead of error buff= er * contrib/lisp/ox-taskjuggler.el (org-taskjuggler-compile): Check the return code of the taskjuggler call instead of the error buffer to determine if the export by taskjuggler was successful or not (ignore warnings). Also, do not erase the output buffer as it is already done by `shell-command'. =2D-- contrib/lisp/ox-taskjuggler.el | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index 5dd9b2202..125cf7891 100644 =2D-- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -998,18 +998,16 @@ Return a list of reports." (let ((outbuf (get-buffer-create "*Org Taskjuggler Output*"))) (unless (file-directory-p out-dir) (make-directory out-dir t)) =2D (with-current-buffer outbuf (erase-buffer)) =2D (shell-command =2D (replace-regexp-in-string =2D "%f" (shell-quote-argument full-name) =2D (replace-regexp-in-string =2D "%o" (shell-quote-argument out-dir) =2D org-taskjuggler-process-command t t) t t) outbuf) =2D ;; Collect standard errors from output buffer. =2D (setq errors (org-taskjuggler--collect-errors outbuf))) =2D (if (not errors) =2D (message "Process completed.") =2D (error (format "TaskJuggler failed with errors: %s" errors)))) + (if (zerop (shell-command + (replace-regexp-in-string + "%f" (shell-quote-argument full-name) + (replace-regexp-in-string + "%o" (shell-quote-argument out-dir) + org-taskjuggler-process-command t t) t t) outbuf)) + (message "Process completed.") + ;; Collect standard errors from output buffer. + (setq errors (org-taskjuggler--collect-errors outbuf)) + (error (format "TaskJuggler failed with errors: %s" errors))))) (file-expand-wildcards (format "%s/*.html" out-dir)))) =20 (defun org-taskjuggler--collect-errors (buffer) =2D-=20 2.16.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEErybpwqHIjTKoaEOGE3NUdytlGJQFAlr+kHQACgkQE3NUdytl GJRMIA/+LIhKYDRtqjEt1TC5AzmXc59uGuQsEur6gdtRZiozNU0jQSyRP4Cz2bju snx1t1VEY1cSklu7d0mPR22zcaCKCzkfWSOMqnLskz2u9dvz+q1yaa02X5E6JeOU ZQ/uOCtdCDcVX7ntZ7p62HLJcSLeEEd2AdP2/pJIGgiaUaPln45nR6NlypINfyvr A9oh1jNKyEN/zmKeDDIpB5T8v5JyKDFYl+2aFYeZ5U3z+7T8sDyWSCgJjdv0OGis PeTpqb/lw/+2BJSetKRE8GD2p3giXte/+Jx33XYHHCT4azOJkGGA40X4JH3QBKrJ txIP4p5iXd4hMbtnrWU8CIFKwk2DjIrbFF2oGDQYTt+iUggXQ4Q58P+rbxFWCdsI WYdOg0KYJdDyiGUCLtIIMCH3CsIYNdY3axcokOpN1clNj3mrVqO25OiHUPwONXcR CXSI6UvDt58fT5wsuKJ99pH/0UK9Wj951xT2hwJoR8MHzDPAl2AHxHOEX+kCZVj2 Jtg33XYgrgEazUA46lwSRdby7wg/aecBVKZoipzDr7RR1J2swDJkFfwPFQRMR30S r0i1nFzszojy7LnILQ9DcJKCmo4ng+ltKk93L2Me6JOVplGOsd6hD0S3TnfecE7t NCJDe2z+PexjhjXitindFCmxxcQcsMyLYeSK6NFVrF3Yaab4FJ4= =jnlP -----END PGP SIGNATURE----- --==-=-=--