Changeset 8967

Show
Ignore:
Timestamp:
11/13/07 23:40:49 (13 months ago)
Author:
asterix
Message:

don't fails gpg encryption when verbose is on. check in status-fd if encryption succeeded. fixes #3542

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/GnuPG.py

    r8927 r8967  
    9393                        self.options.recipients = recipients   # a list! 
    9494 
    95                         proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 
     95                        proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 'status', 
    9696                                'stderr']) 
    9797                        proc.handles['stdin'].write(str) 
    98                         proc.handles['stdin'].close() 
    99  
    100                         output = proc.handles['stdout'].read() 
    101                         proc.handles['stdout'].close() 
     98                        try: 
     99                                proc.handles['stdin'].close() 
     100                        except IOError: 
     101                                pass 
     102 
     103                        output = proc.handles['stdout'].read() 
     104                        try: 
     105                                proc.handles['stdout'].close() 
     106                        except IOError: 
     107                                pass 
     108 
     109                        stat = proc.handles['status'] 
     110                        resp = self._read_response(stat) 
     111                        try: 
     112                                proc.handles['status'].close() 
     113                        except IOError: 
     114                                pass 
    102115 
    103116                        error = proc.handles['stderr'].read() 
     
    106119                        try: proc.wait() 
    107120                        except IOError: pass 
     121                        if 'BEGIN_ENCRYPTION' in resp and 'END_ENCRYPTION' in resp: 
     122                                # Encryption succeeded, even if there is output on stderr. Maybe 
     123                                # verbose is on 
     124                                error = '' 
    108125                        return self._stripHeaderFooter(output), error 
    109126