Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Decompress Does Not Always Trigger 'Then' Promise #42

Open
jriffel opened this issue Jun 28, 2016 · 3 comments
Open

Windows Decompress Does Not Always Trigger 'Then' Promise #42

jriffel opened this issue Jun 28, 2016 · 3 comments

Comments

@jriffel
Copy link

jriffel commented Jun 28, 2016

Hi - Great plugin we are using to decompress a lot of files. I came across a certain distribution (phpMyAdmin) which decompresses but fails to invoke the 'then' promise. This only happens on Windows, I verified it works fine on OSX (not verified on Linux, but I assume to be Windows only). Another interesting fact is that the same failure happens with any format of their distribution (zip, tar.gz, tar.bz2). You can test with any of their downloads from:

https://www.phpmyadmin.net/downloads/

Here is the test case I used to show this issue:

var decompress = require('decompress');

decompress('c:\\temp\\phpMyAdmin-4.6.3-english.tar.bz2', 'c:\\temp').then(files => { 
  console.log('Finished!');
}).catch(function(err) {
  console.log(err);
});

console.log('End of Script');

On Windows this test script will extract the entire archive, but never log 'Finished!'. On other platforms it works as intended. I am suspicious of circular references and symlinks in the archive but it should still invoke the promise. I also tried test, extracting, and re-creating the archive but the behavior remains the same.

Thanks and let me know if I can be of further assistance.

@CodeMan99
Copy link

(note, I am not a maintainer)

I really doubt the issue is with decompress not returning a promise. The library always returns a promise, and file writing happens within an internal .then. So if you are getting files, the promise chain must be functioning.

I would hazard a guess that your console.log('Finished') statement isn't writing to the TTY device for some reason.

@frank-eisen
Copy link

I have the same bevahiour with a zip-file from arangodb.

When running decompress on it, it read the zip file completely and creates all files and directories (it seems so at least), but all created files are empty and no catch or then is triggered. The node script also keeps running until you terminate it.
While the script is still running, you cannot modify or delete the uncompressed directory of the zip. So it seems to me that one promise will not be fullfilled and it will keep a file/folder opened under some circumstances, that I do not know yet. I will try to investigate more tomorrow.

Unfortunately I have to say, that this behaviour seems to be a bit random:
before I could unpack the same zip-file without any problems and received a then. But now, it suddenly stopped working.

@frank-eisen
Copy link

Sorry, I couldn't find any reason why the files are empty. All files seems to be read correctly from the zip file, but somehow and with no error or execption your fsP.writeFile isn't writing any content.

I tried it with and without pify (promisifyer) and with your used graceful-fs as well as standard nodejs fs. I also tried writing it via fs.write (that is actually used in fs.writeFile), but I couldn't get any further information.

Disk quota and writing permission I could exclude as reasons.

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

No branches or pull requests

3 participants