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
|
@ -26,16 +26,7 @@ class GPGEncryptor:
|
||||||
|
|
||||||
def encrypt(self):
|
def encrypt(self):
|
||||||
p = subprocess.Popen( self._command(), stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE )
|
p = subprocess.Popen( self._command(), stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE )
|
||||||
(stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
|
encdata = p.communicate(input=self._message)[0]
|
||||||
|
|
||||||
# Write the data
|
|
||||||
stdin.write(self._message)
|
|
||||||
stdin.close()
|
|
||||||
|
|
||||||
# Read the encrypted data
|
|
||||||
p.wait()
|
|
||||||
encdata = stdout.read()
|
|
||||||
|
|
||||||
return encdata
|
return encdata
|
||||||
|
|
||||||
def _command(self):
|
def _command(self):
|
||||||
|
|
Loading…
Reference in New Issue