On Sun, Sep 23, 2018 at 04:04:58PM +0300, ПИван Петров wrote: > Reason of this "message bug" is: search line with "###" ! > > ========== Output ===================== > root@machine:/home/user# dd if=/dev/zero of=/dev/sdb status=progress bs=128M > dd: write error '/dev/sdb': No free space on device > 9+0 got records > 8+0 sent records > 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 0,962915 s, 1,1 GB/s > > root@machine:/home/user# parted --machine /dev/sdb unit B print free quit > Ошибка: /dev/sdb: метка диска не определена ###: (translated: "Error: > /dev/sdb: label of disk not defined") > BYT; > /dev/sdb:1073741824B:scsi:512:512:unknown:VMware, VMware Virtual S:; > > root@machine:/home/user# $? > 0: command not found
If you use --script it will return a 1 in this case. > > root@machine:/home/user# parted --version > parted (GNU parted) 3.2 > Copyright © 2014 Free Software Foundation, Inc. > Лицензия GPLv3+: GNU GPL версии 3 или новее < > http://gnu.org/licenses/gpl.html> > Это свободное ПО: вы можете продавать и распространять его. > Нет НИКАКИХ ГАРАНТИЙ до степени, разрешённой законом. > > Автор программы — < > http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>. > > root@machine:/home/user# uname -a > Linux machine 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 > x86_64 x86_64 x86_64 GNU/Linux > ============= End Output ============================== > > I think, that the message "###" is not a error, because: > 1. already undestand, that the disk cant have disk table and do not have > labels of partitions (already="unknown" table) > 2. for "--machine" output need strong/constantly output, without "sudden > messages" (without ";" at end of line) > > Please remove this message from stderr - it is not a error and this message > hinder to "--machine" output! I agree, somewhat, but it would be difficult to squash parted's normal exception handling for cases like this. Note that it *is* output on stderr so if you don't want to capture it just grab stdout. And if you use --script it will return a proper error result code. -- Brian C. Lane (PST8PDT)