[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add Netpbm messages to verbose output (issue 240950043 by address@hi
From: |
trueroad |
Subject: |
Re: Add Netpbm messages to verbose output (issue 240950043 by address@hidden) |
Date: |
Sun, 31 May 2015 13:51:20 +0000 |
Reviewers: J_lowe,
Message:
I've pushed.
Issue 4420: Add Netpbm messages to verbose output
author Masamichi Hosoda <address@hidden>
Mon, 25 May 2015 14:41:16 +0000 (23:41 +0900)
committer Masamichi Hosoda <address@hidden>
Sun, 31 May 2015 13:39:19 +0000 (22:39 +0900)
commit b666e5959e3eb170e57bb1937f9589cfbe7c0ae4
Description:
Add Netpbm messages to verbose output
Messages of Netpbm commands
(pngtopnm, pnmscale, pnmtopng)
output to /dev/null.
So those messages couldn't be read.
This patch can add them to verbose output,
and they can be read.
Please review this at https://codereview.appspot.com/240950043/
Affected files (+20, -15 lines):
M scm/ps-to-png.scm
Index: scm/ps-to-png.scm
diff --git a/scm/ps-to-png.scm b/scm/ps-to-png.scm
index
3b6b6c2452c719aa9963685d30861944172af19c..a0ad39253a03b85bd2c80d923d7ced8ce660a3fe
100644
--- a/scm/ps-to-png.scm
+++ b/scm/ps-to-png.scm
@@ -71,20 +71,25 @@
(if exit-on-error (exit 1))))
status)
-(define (scale-down-image be-verbose factor file)
- (define (with-pbm)
- (let* ((status 0)
- (old (string-append file ".old")))
-
- (rename-file file old)
- (my-system
- be-verbose #t
- (format #f
- "pngtopnm \"~a\" | pnmscale -reduce ~a 2>/dev/null |
pnmtopng -compression 9 2>/dev/null > \"~a\""
- old factor file))
- (delete-file old)))
-
- (with-pbm))
+(define (scale-down-image factor file)
+ (let* ((old (string-append file ".old"))
+ ;; Netpbm commands (pngtopnm, pnmscale, pnmtopng)
+ ;; outputs only standard output instead of a file.
+ ;; So we need pipe and redirection.
+ ;; However, ly:system can't handle them.
+ ;; Therefore, we use /bin/sh for handling them.
+ ;; FIXME: MinGW (except Cygwin) doesn't have /bin/sh.
+ (cmd
+ (list
+ "/bin/sh"
+ "-c"
+ (ly:format
+ "pngtopnm \"~a\" | pnmscale -reduce ~a | pnmtopng -compression
9 > \"~a\""
+ old factor file))))
+
+ (rename-file file old)
+ (ly:system cmd)
+ (delete-file old)))
(define-public (ps-page-count ps-name)
(let* ((byte-count 10240)
@@ -177,5 +182,5 @@
(if (not (= 1 anti-alias-factor))
(for-each
- (lambda (f) (scale-down-image be-verbose anti-alias-factor f))
files))
+ (lambda (f) (scale-down-image anti-alias-factor f)) files))
files)))