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
Wait forever when running an unzip file command #41
Comments
Ok. i tried just unzipping a small text file. Same thing. |
OK. So i have now tried the and it correctly unzips the file on terminal, but, let output = try SwiftShell.runAndPrint("unzip", "/Users/jt/Desktop/Bob/myZipFile.zip", "-d", "/Users/jt/Desktop/Bob") |
to see if it is bash that never returns. If that doesn't work I'll take a look when I get back to my computer on Monday. |
ok. I'll update this over the weekend. And give you the results. |
I have tested this with This is very strange, I don't really have any theories at the moment. Have you found any way to work around it? |
@kareman the workaround for now is to use Although the I remember way back in my school days something about flushing stdout buffers? But im not sure if this has anything to do with this. It was too long ago. |
I think the problem only occurs when the “unzip” command asks for an answer to a question (like if it should overwrite already existing files). And it seems it only does this when standard input is a terminal. Some workarounds are
or
Or maybe you can call the unzip command with the flags "-n never overwrite existing files" or "-o overwrite files WITHOUT prompting". Please let me know if any of these suggestions solve your problem. |
I am having the same issue here as @patchthecode. The bash command does not seem to ever return. I can get it to unzip with this command: If I then put a flag in the command it no longer returns: Interestingly those same commands work fine when I use runAndPrint instead: I am just trying to avoid the console output because its very verbose and doesn't add anything to my script. |
What happens if you try |
Yea you are correct it only happens when unzip asks for more input. I thought I was careful to make sure to delete the unzipped file after I was done with it. On a second run of the same script it fails. I was missing a delete of a __MACOSX directory that unzip creates. That was causing unzip to ask for input.
Clears the prompt and allows it to continue. |
Excellent. I'll close this issue now. @patchthecode feel free to reopen it if your problem was not resolved. |
@kareman i'll try it today and let you know |
we have this as the command.
This is just supposed to unzip a rather large zip file (100Mb)
But the Swift shell freezes the app.
We traced it down to where control is frozen, it is in this file
Command.swift
We are forced to downgrade back to 3.0.0Beta in the mean time. Thanks for your work. Awesome library.
The text was updated successfully, but these errors were encountered: