Giter Club home page Giter Club logo

Comments (8)

nickjj avatar nickjj commented on May 26, 2024

Hi,

Which version of macOS are you using? I've noticed on certain macOS machines this happens but not all. I've also never seen it happen on native Linux or WSL.

A workaround is to remove the u in set -euo pipefail on line 3. I'm thinking about pushing that up as a change too. Having set -u protects you from having a script with unbound variables (common reasons for this are typos in variable names) but I guess some versions of Bash don't like it with $@.

from docker-django-example.

chanana avatar chanana commented on May 26, 2024

Aha, interesting! I'm on macOS Catalina Version 10.15.7.

Removing the -u option from line 3 did the trick.

I'm not well versed in shell parameter expansions; could this be a solution?

from docker-django-example.

nickjj avatar nickjj commented on May 26, 2024

If you run bash --version what version do you get back?

In our case we're using ${@} which will let you pass in 0 or more arguments from our script to the command we're calling. This way you can naturally pass in multiple arguments to a command just as you would if you called it directly.

Setting a default is a reasonable idea with $1 because it's only dealing with 1 argument.

If we set "${@:-}" (an empty default) it's going to convert that to sending in "" which will make the underlying command fail. If we don't use quotes then it's not going to work as intended (it won't get parsed correctly).

from docker-django-example.

chanana avatar chanana commented on May 26, 2024

running bash --version produces:

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

I understand what you mean with the ${@} vs the "${@}". This and this are great explanations for people looking at this in the future...

from docker-django-example.

nickjj avatar nickjj commented on May 26, 2024

I should probably bite the bullet and yank out the u flag. Having it not work for a decent chunk of Mac users isn't a good alternative to having unbound variable protection. I remember researching how to do this once while keeping it in but coming up empty handed. Going to give it a day or so to think about it and then either remove u or patch in a proper fix.

If anyone has any suggestions let me know.

from docker-django-example.

chanana avatar chanana commented on May 26, 2024

If I understand the run file correctly, you have _dc which is combined with the various functions to run the commands. For example, if a user wanted to run lint their code with flake8, they would normally run

flake8 my_project

but since the website is inside the "web" docker container, you'd have to first specify docker-compose and -exec and -T which you've cleverly handled with _dc and cmd. The "{@}" in the flake8 function simply looks for additional arguments to flake8? But there is also an @ in the cmd command itself. As a naive question, what is the actual command being run when I type in ./run flake8 --version? Is it docker-compose exec web flake8 --version?

from docker-django-example.

nickjj avatar nickjj commented on May 26, 2024

What is the actual command being run when I type in ./run flake8 --version? Is it docker-compose exec web flake8 --version

Yep you got it. The only difference would be if you were running it in an environment that lacks a TTY then docker-compose exec -T web flake8 --version would be run instead.

from docker-django-example.

nickjj avatar nickjj commented on May 26, 2024

I decided to push the fix to the main branch. Here's the commit: d6dc0b6

I'd rather have the examples work for everyone as soon as possible. Can always add u back at a later time if a proper workaround is discovered.

Thanks for the report. Going to close this.

from docker-django-example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.