Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Send data to openssl pipe via communicate instead of stdin.write #12

Merged
merged 2 commits into from Jun 28, 2014

Conversation

eddiejessup
Copy link
Contributor

Recently a big file that I encrypt using this plugin started breaking Sublime Text: it froze when I entered my password. Looking into it, it was the line openssl.stdin.write( data.encode("utf-8") ) that was the issue. From the subprocess docs,

Warning Use communicate() rather than stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process.

I think this is what was happening, as it's only big files that break it. I moved the data input to the communicate line, and now it works for me.

I only realised the solution was so simple just now, and before realising that I made a fork of your plugin using the PyCrypto module that went on the package manager today! I'm not sure whether to keep it since it isn't really needed any more.

mediaupstream added a commit that referenced this pull request Jun 28, 2014
Send data to openssl pipe via communicate instead of stdin.write
@mediaupstream mediaupstream merged commit 5df3d9c into mediaupstream:master Jun 28, 2014
@mediaupstream
Copy link
Owner

Awesome, thanks @eddiejessup. I never tried running the plugin on anything very large, good find!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants