[parted-devel] [PATCH 0/3] Send errors to stderr, not stdout.
Richard W.M. Jones
rjones at redhat.com
Wed Oct 12 21:16:33 UTC 2011
Even with the -m and/or -s option which are supposely designed to make
parted machine-readable, it still mixes error messages and warnings on
stdout. In practice this makes it not machine-readable at all.
Example:
$ truncate -s 1M /tmp/test1.img
$ parted -m -- /tmp/test1.img unit b print
WARNING: You are not superuser. Watch out for permissions.
Error: /tmp/test1.img: unrecognised disk label
BYT;
/tmp/test1.img:1048576B:file:512:512:unknown:;
The "WARNING:..." and "Error:..." lines go to stdout.
These patches fix most of the problems, sending errors and warnings to
stderr where they belong. Parsing can now be attempted more sanely:
$ ~/d/parted/parted/parted -m -- /tmp/test1.img unit b print 2>/dev/null
BYT;
/tmp/test1.img:1048576B:file:512:512:unknown:;
Rich.
More information about the parted-devel
mailing list