Git Product home page Git Product logo

Comments (6)

anki-code avatar anki-code commented on June 25, 2024

Originally posted by @bestlem in #5488 (comment)

The issue is that I need to set $PATH and other environment variables. This is done via Login shell in most Unix or the registry in Windows. In macOS/Next nothing sets it.

As for fish they use the --is-interactive flags to stop inclusion of unneeded stuff.
As for zsh it includes ~/.zshenv
bash is the outlier of the current main shells.

Separation of concerns - the script does not set the environment but the initialisation/login shell does.

from xonsh.

anki-code avatar anki-code commented on June 25, 2024

Originally posted by @bestlem in #5488 (comment)

Part from the environment issue my main issues here are

  1. We must have --no-rc and the opposite to load rc files in shebangs and -i means run interactively and that is independent of not reading rc files, there need to be a separate flag for the opposite of --no-rc reading the default files. (Unfortunately --rc is taken). (This is the error we had in the first place interactive means using the keyboard and not just choosing which files to load)

  2. Consistency - I think for most shells the config files in ~ and ~/.config have exactly the same functionality or that only the ons in ~ matter (bash/sh/csh don't understand XDG and zsh needs you to change ZDOTDIR). I don't think anything else reads both. Different behaviour for xonsh could be confusing.

  3. Consistency - I think all shells read both the ones in home and /etc or they read none. Does xonsh have a reason to do differently?

I can accept the current suggestion but points 2 & 3 have to be documented
There needs to be a flag to run xonsh scripts reading config files in non-interactive mode,

I sort of accept the comment about piping things >> .xonshrc but that is really bad documentation of the program providing the setup - as I note several projects do get this correct for fish and several don't - In general there are a lot of projects that just assume GNU/Linux and so bash and don"t do things cross platform - bash does have a test for interactive or not (found in the nix generated file)

# Commands that should be applied only for interactive shells.
[[ $- == *i* ]] || return
below here are all aliases and prompt stuff

There are reasons not to want to use bash

from xonsh.

anki-code avatar anki-code commented on June 25, 2024

@bestlem thank you for explanation but I think I can't understand this without examples but I want to help you.

This can help me understand the case:

  • repetable environement like docker with list of commands that I can repeat and faced with problem
  • OR the list of commands you're doing the result you're getting and explain where is the problem and why.

I'm manjaro/macos user where I have never faced with any kind of rc issues. I understand how xonsh is working. I want to help you. But I really don't understand what exactly you're doing, what you expect and what is the problem.

I want to give you group of random commands to confirm that you know this and confirm that you can't construct the solution from this.

# xonsh 0.17.0
xonsh -DPATH=/tmp -DXONSHRC=file1:file2  # overwrite any env variables
xonsh --no-env  # do not inherit environment AND use xonsh own default
xonsh --rc file1 file2  # list of rc files to load
xonsh --no-rc  # disable rc files
xonsh -i   # load all possible rc files (after 5491)

xonsh --no-env -DXONSHRC= -DXONSHRC_DIR=/my/path  # combination

# Defaults
$XONSHRC
# ('/etc/xonsh/xonshrc', '/USERHOME/.config/xonsh/rc.xsh', '/USERHOME/.xonshrc')
$XONSHRC_DIR
# ('/etc/xonsh/rc.d', '/USERHOME/.config/xonsh/rc.d')

There is no way to solve your issue with this?

from xonsh.

bestlem avatar bestlem commented on June 25, 2024

xonsh -i means run setting $XONSH_INTERACTIVE it should say nothing about reading startup files.
Running with startup files is a separate concept - how do you run a non-interactive shell loading the default startup files. (OK I can't see a case for xonsh -i not loading startup files except for some debugging but that is not the issue it is xonsh without the -i)

This is the same points I made in #4096 see my comment of Mar 6, 2021 and @Eximius"s comment

There has to be a case that
xonsh -some-flag script.xsh runs
and $XONSH_INTERACTIVE is false and the standard startup files are read. To match fish and zsh I would expect no flag here but can deal with having to provide a flag.

from xonsh.

anki-code avatar anki-code commented on June 25, 2024

There has to be a case that xonsh -some-flag script.xsh runs and $XONSH_INTERACTIVE is false and the standard startup files are read.

Xonsh defaults:

# Defaults
$XONSHRC
# ('/etc/xonsh/xonshrc', '/USERHOME/.config/xonsh/rc.xsh', '/USERHOME/.xonshrc')
$XONSHRC_DIR
# ('/etc/xonsh/rc.d', '/USERHOME/.config/xonsh/rc.d')

@bestlem I'm wondering why you can't put the configs you need in ('/etc/xonsh/rc.d', '/USERHOME/.config/xonsh/rc.d') after #5099 was merged and checking for XONSH_INTERACTIVE and XONSH_LOGIN?

from xonsh.

anki-code avatar anki-code commented on June 25, 2024

Closed by #5099 #5491

from xonsh.

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.