equinor / komodoenv

Komodoenv is the virtualenv of the Komodo world
GNU General Public License v3.0
1 stars 3 forks source link

`komodoenv` assumes `subprocess` `/bin/bash` only prints output from command #36

Closed anders-kiaer closed 2 years ago

anders-kiaer commented 2 years ago

I have one line printed when a new terminal is started, resulting in the assert statement on line 71 https://github.com/equinor/komodoenv/blob/45d0ccd26c9d6f81c3503ec52e5c3a8931527c95/komodoenv/__main__.py#L59-L71 failing (3 !== 2).

Could one easy fix be to relax it to >= 2 and then use the last two output lines (i.e. effectively ignoring any start-up messages the user has in bash)?

pinkwah commented 2 years ago

What are you printing? Perhaps it should only be printed when bash is run in interactive mode?

jondequinor commented 2 years ago

And how are you printing?

anders-kiaer commented 2 years ago

Printing "indirectly" by sourcing /prog/sdpsoft/env.sh (which gives a printed line at source time it seems).

jondequinor commented 2 years ago

What does BASH_ENV= bash -c "echo foo" print? Compare it to bash -c "echo foo".

anders-kiaer commented 2 years ago

The former gives no line, the latter prints the same line (and moving the source command to .bash_profile gives no printed line for both commands 👍).

pinkwah commented 2 years ago

The PR might not be a bulletproof fix. If this issue occurs again, feel free to reopen.