Understanding Dart example in docs

Hey community,
I’ve tried looking what exactly /bin/bash --login -eo pipefail this code from the example does but couldn’t find anything. Could you direct me to an article or explain what it does?

Thanks.

commands:
  dependencies:
    description: "Download dependencies and setup global packages"
    parameters:
      shell:
        type: string
        default: "/bin/bash --login -eo pipefail"
      pub-cache:
        type: string
        default: "~/.pub-cache"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1.4-dependencies-{{ arch }}-{{ checksum "pubspec.lock" }}
            - v1.4-dependencies-{{ arch }}-
      - run:
          name: Download deps
          shell: << parameters.shell >>
          command: pub get
      - run:
          name: Get junitreporter
          shell: << parameters.shell >>
          command: pub global activate junitreport
      - save_cache:
          key: v1.4-dependencies-{{ arch }}-{{ checksum "pubspec.lock" }}
          paths:
            - .dart_tool
            - << parameters.pub-cache >>

  native-build:
    description: "Runs the dart2native command to build native executable for machine. Artifacts executable"
    parameters:
      shell:
        type: string
        default: "/bin/bash --login -eo pipefail"
    steps:
      - run:
          name: Native compile
          shell: << parameters.shell >>
          command: dart2native bin/server.dart -o circleci_dart_demo.exe
      - store_artifacts:
          path: circleci_dart_demo.exe

So I found this gist which explained what set -euxo pipefail does. I believe -eo pipefail is derived from this command.

What about --login part?

Hi happy-san,

The shell options that we use, and their meaning are documented in the config reference. If this doesn’t cover what you need, feel free to open an Issue on the repo.

The --login option specifies that a login shell is used for commands. You can read more about it on the bash man page.

Marc

1 Like

Hey Marc! Thanks for sharing the links.