GithubHelp home page GithubHelp logo

Comments (3)

ahmetb avatar ahmetb commented on May 15, 2024 1

The script already has -o pipefail set :)

See the stackoverflow link above. I think it's because we're calling it like for c in $(get_contexts) which isn't failing properly b/c it's in sub-shell.

from kubectx.

ahmetb avatar ahmetb commented on May 15, 2024

Some of this is fixed in 6610d70, but here's a case that still swallows some errors:

$ brew unlink kubectl # or make kubectl unavailable to the kubectx

# kubens
/Users/ahmetb/.homebrew/bin/kubens: line 48: kubectl: command not found
/Users/ahmetb/.homebrew/bin/kubens: line 39: kubectl: command not found
/Users/ahmetb/.homebrew/bin/kubens: line 52: kubectl: command not found

instead, the first occurrence of the error should've caused script to exit.

I found that if I add set -e to the caller functions, it fails as expected, but I probably shouldn't add set -e to all functions like that.

from kubectx.

2rs2ts avatar 2rs2ts commented on May 15, 2024

Isn't the problem from your OP that you don't have pipefail set?

% false | echo hi
hi
% echo $?
0
% set -o pipefail
% false | echo hi
hi
% echo $?
1

from kubectx.

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.