Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RVM 1.10.1 and CodeRunner:No value for $TERM and no -T specified #698

Closed
scriptfans opened this issue Jan 12, 2012 · 18 comments

Comments

Projects
None yet
5 participants
@scriptfans
Copy link

commented Jan 12, 2012

I'm use the Mac app CodeRunner to execute ruby snippets, It play correctly with RVM, but when I update to the latest version (1.10.1) of RVM, It's seem to has some problem: It always prints an error message: ‘tput: No value for $TERM and no -T specified’, you can go to the following link to view details:

https://www.ruby-forum.com/topic/3165479

how to fix this problem?

@scriptfans

This comment has been minimized.

Copy link
Author

commented Jan 12, 2012

with version 1.10.0, it work correctly:

1.10.0

but version 1.10.1 has some error message:

1.10.1

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 12, 2012

try prefixing your command in Run Command with TERM=xtrem - this is now required as RVM detects terminal and uses colors, so if your CodeRunner simulates terminal it should also be providing TERM environment variable

@scriptfans

This comment has been minimized.

Copy link
Author

commented Jan 12, 2012

Thank you, prefix the TERM=xtrem or $TERM=xtrem or export $TERM=xtrem all does not work :(

run command

it's seem to the $TERM still has the value of 'dumb':

result

Who can help me?

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 12, 2012

it should be TERM=xtrem source ..., what is your whole command ?

@scriptfans

This comment has been minimized.

Copy link
Author

commented Jan 13, 2012

the new version of CodeRunner now can recognition of user's PATH variables, so I edited the Run Command back to 'ruby $filename', but when I run ruby code it's still output the message. and it causes the problem in all other languages snippets output, etc the Python, ObjectiveC. Then, I try to edit my ~/.profile to add the prefixes to RVM's config.
before the change:
[[ -s /Users/scriptfans/.rvm/scripts/rvm ]] && source /Users/scriptfans/.rvm/scripts/rvm
after try to run the echo $TERM command in the Terminal, i see the output is xterm-256color, so i do as you say,change the config to:
[[ -s /Users/scriptfans/.rvm/scripts/rvm ]] && TERM=xterm-256color source /Users/scriptfans/.rvm/scripts/rvm
and all's right with the world.

But is that correct? will have any side effects? I'm not sure.

I think this is a RVM's bug, because the old version is no problem.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

@scriptfans rvm enables colors by default starting with 1.10.1 - the issue is with your terminal, it should provide proper TERM variable value, if it does not do that then commands like tput - will not work as expected - and rvm uses it for colors.

I could add a check in rvm to disable colors for TERM == dumb ... but does it solve all problems ? in my opinion it will only silence the problem, not giving you (or CodeRunner) a chance to fix it - CodeRunner acts as a terminal simulator and it should provide proper TERM value.

@richo

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

@mpapis will you accept a PR to make all tput calls dependant on having TERM set?

I think it's saner behavior.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

@richoH the place for the fix is here: https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/logging#L15

but as I wrote I'm not sure it is the right way ... the test for proper TERM should happen in the case of auto only ... what's the proper TERM

richo added a commit to richo/rvm that referenced this issue Jan 13, 2012

@richo

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

@mpapis cronjobs for example don't allocate a pty and so will never have a valid term. I've just pushed a branch with an early bailout from the color function and all tput calls wrapped, your call whether or not to merge it.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

@richoH do the cronjobs allocate terminal ? we are using the shell -t check:

-t fd  True if file descriptor fd is open and refers to a terminal.

my fast tests show that cron does not operate using a terminal so it's still valid

@richo

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

That will only help with the output from the logging script.. a cursory git grep -e "(tput " shows a lot of other invocations.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

all of those all wrapped or fixed by rvm_pretty_print if not then they should be ... but I was going through whole project and thought I wrapped them all

@richo

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

I just opened pull request #700.

In any case, @scriptfans feel free to pull that branch, it should fix your issue.

@scriptfans

This comment has been minimized.

Copy link
Author

commented Jan 13, 2012

thanks very much! I have sent an email to the CodeRunner's author, hope he can solve this problem as soon as possible.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 13, 2012

should be fixed with 18d602f

@mpapis mpapis closed this Jan 13, 2012

@mattconnolly

This comment has been minimized.

Copy link
Contributor

commented Jan 28, 2012

Incidentally, I'm still experiencing this same issue with Jenkins and rvm 1.10.2. I'm doing an "export TERM=xterm" at the top of my build scripts to get it working.

@mpapis

This comment has been minimized.

Copy link
Member

commented Jan 28, 2012

@soundevolution this is another issue and will be fixed with #726

@mattconnolly

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2012

@mpapis Thanks.

@pkuczynski pkuczynski added this to the rvm-1.27.0-before milestone May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.