Removed stdin.write and stdout.read from GnuPG and replaced it with subprocess.communicate, to avoid deadlocks when larger messages are passed in
This commit is contained in:
parent
2b3f792271
commit
078381c2dd
1 changed files with 1 additions and 10 deletions
|
@ -26,16 +26,7 @@ class GPGEncryptor:
|
|||
|
||||
def encrypt(self):
|
||||
p = subprocess.Popen( self._command(), stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE )
|
||||
(stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
|
||||
|
||||
# Write the data
|
||||
stdin.write(self._message)
|
||||
stdin.close()
|
||||
|
||||
# Read the encrypted data
|
||||
p.wait()
|
||||
encdata = stdout.read()
|
||||
|
||||
encdata = p.communicate(input=self._message)[0]
|
||||
return encdata
|
||||
|
||||
def _command(self):
|
||||
|
|
Loading…
Reference in a new issue