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

Fix standard output redirect issue when running the Docker command in PowerShell #110

Open
andrewdbate opened this issue Oct 11, 2021 · 4 comments

Comments

@andrewdbate
Copy link

I have found some typos / inaccuracies on the following page that provides instructions for the CLI:
https://github.com/gildas-lormeau/SingleFileZ/blob/master/cli/README.MD

The pages says:

Run and redirect the result into a file
docker run singlefilez "https://www.wikipedia.org" > wikipedia.html

Whilst this might work on Linux/Mac, it does not work on Windows. If you try the above command on Windows, the file wikipedia.html will not be readable by the SingleFileZ extension in the browser (in fact, when I tried this, the file wikipedia.html was not even a valid zip file). I am guessing that the line endings must have messed up the file (because Windows uses \r\n for line endings, whereas *nix uses \n).

The page also says the following:

Run and mount a volume to get the saved file in the current directory

Save one page

docker run -v %cd%:/usr/src/app/out singlefile "https://www.wikipedia.org" wikipedia.html (Windows)

docker run -v $(pwd):/usr/src/app/out singlefile "https://www.wikipedia.org" wikipedia.html (Linux/UNIX)

Save one or multiple pages by using the filename template (see --filename-template option)

docker run -v %cd%:/usr/src/app/out singlefile "https://www.wikipedia.org" --dump-content=false (Windows)

docker run -v $(pwd):/usr/src/app/out singlefile "https://www.wikipedia.org" --dump-content=false (Linux/UNIX)

Each of the above 4 commands use singlefile as the docker image name, when it should instead be singlefilez.

Many thanks!

@gildas-lormeau
Copy link
Owner

Thank you, I fixed the typos.

However, I was not able to reproduce the issue related to invalid zip files on Windows. When I run the command docker run singlefilez "https://www.wikipedia.org" > out.html on the CLI of Windows 10 (pro), the resulting file is a valid zip and can be opened in Firefox.

gildas-lormeau added a commit that referenced this issue Oct 11, 2021
@andrewdbate
Copy link
Author

I've just double checked on Windows 10 Pro and it works with command prompt but is does not work with PowerShell.

So running docker run singlefilez "https://www.wikipedia.org" > out.html from Command Prompt (cmd.exe) produces a valid file out.html.

However, running docker run singlefilez "https://www.wikipedia.org" > out.html from PowerShell produces a file out.html which is not even a valid zip file.

@gildas-lormeau
Copy link
Owner

Thank you for the clarification. I'll add a note that it must be run from cmd.exe. I don't know (yet) how to fix this issue in PowerShell.

@gildas-lormeau
Copy link
Owner

@gildas-lormeau gildas-lormeau changed the title Typos in CLI usage instructions Fix standard output redirect issue when running the Docker command in PowerShell Oct 12, 2021
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

2 participants