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

node-red-start leaks terminal window title #16

Open
ygoe opened this issue Jul 10, 2021 · 14 comments
Open

node-red-start leaks terminal window title #16

ygoe opened this issue Jul 10, 2021 · 14 comments

Comments

@ygoe
Copy link

ygoe commented Jul 10, 2021

What are the steps to reproduce?

  • Install Node-RED as per this guide
  • Start it from the terminal by executing node-red-start
  • Watch the log as it starts
  • Quit the log view and get back to the shell prompt by pressing Ctrl+C

What happens?

The terminal window title remains "Node-RED console" and doesn't change back again. This makes it a bit harder to distinguish the PuTTY windows on my desktop to find the correct host to work with.

What do you expect to happen?

Either don't change that title at all, or at least change it back to what it was before when leaving the program.

Please tell us about your environment:

  • Node-RED version: v1.3.5
  • Node.js version: v14.17.2
  • npm version: 6.14.13
  • Platform/OS: Raspberry Pi OS, Linux 5.10.17-v7+ arm LE
  • Browser: n/a (PuTTY SSH terminal)
@ygoe
Copy link
Author

ygoe commented Jul 10, 2021

In a fresh installation I noticed that this also affects the installation script which sets a slightly different title but also leaves it there like it didn't care to clean up after itself.

@knolleary knolleary transferred this issue from node-red/node-red Jul 10, 2021
@dceejay
Copy link
Member

dceejay commented Jul 10, 2021

What does putty set it to ?

@ygoe
Copy link
Author

ygoe commented Jul 11, 2021

The host name that the session is connected to. But I can configure it as I like.

@dceejay
Copy link
Member

dceejay commented Jul 11, 2021

hmm - I don't have a windows box to test with putty at present- If I try a simple ssh session on Mac or Linux I see the title as
image
and when I then Ctrl-c to stop it I see
image
So it seems to revert fine in this instance.

  • But we can always add the hostname as well.

@ygoe
Copy link
Author

ygoe commented Jul 11, 2021

Maybe your shell prompt does that? It has the current path in it after all. Mine doesn't touch the terminal title.

@dceejay
Copy link
Member

dceejay commented Jul 11, 2021

maybe it's a putty thing - and you can turn it off - see https://serverfault.com/questions/178469/how-can-i-set-puttys-window-title-to-the-name-of-the-loaded-session
image

@ygoe
Copy link
Author

ygoe commented Jul 11, 2021

I don't want to reconfigure my terminal just because a single program doesn't clean up after itself. Are you throwing away your stuff anywhere you go and then say: you could go another way so you don't see my garbage? I guess not. That's why I opened this issue to improve the situation. I'm not going to install Node-RED every week and it's really nothing critical, so this isn't an urgent issue.

@dceejay
Copy link
Member

dceejay commented Jul 12, 2021

Hi,
interesting point of view. I have shown you that a simple command line ssh session does restore the name ok, and that a 3rd party application over which I have no control decides not to, but can be set to ignore renaming - and somehow I'm the bad guy.

I have now found a windows 10 box with putty on and this is the result. (with default install of putty 0.75 - no special session config.)
And as you can see that also reverts the title just fine.

1ErsKPWFhd

@ygoe
Copy link
Author

ygoe commented Jul 12, 2021

Please show me the value of your shell prompt variable, I think it's called $PS1. If it sets the terminal title, then that's your personal fun but not the default environment of at least Raspberry Pi OS, maybe many more. And if I want to be able to set the title from other programs, then configuring my terminal to (non-default, too) ignore the titles, that'll break. So after considering all the facts, yes, node-red has the fault.

@dceejay
Copy link
Member

dceejay commented Jul 12, 2021

Hi - I haven't knowingly touched this since installing Raspbian. How is yours set ?

pi@pi3:~ $ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\]

If I check a local ubuntu machine I see

echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

So they are almost identical - and it too also reverts the terminal name in putty just fine... so maybe it is your environment that is non-standard ? as I have "no personal fun" :-)

Which version of windows and putty are you using ?

@dceejay
Copy link
Member

dceejay commented Jul 12, 2021

just for grins I have also just tried a vanilla fedora system

echo $PS1
[\u@\h \W]\$

and indeed putty reverts just fine when running Node-RED scripts also... so not sure where else to go with this.

@ygoe
Copy link
Author

ygoe commented Jul 12, 2021

echo $PS1
\n\A \[\e[0;31m\]\u\[\e[0m\]@\[\e[0;33m\]\h\[\e[0m\] \[\e[1;34m\]\w \[\e[0m\]>

Sorry, might be $PROMPT_COMMAND, mine is empty. I don't know much about these features of bash.

Well, if you can't reproduce this anywhere and nobody else is here to care, it must be my computer. I'll just add a note in my installation instructions to relogin after this.

@dceejay
Copy link
Member

dceejay commented Jul 13, 2021

my $PROMPT_COMMAND is also empty, but using your PS1 does also cause mine to fail... finally I can see your issue.

@ygoe
Copy link
Author

ygoe commented Jul 13, 2021

As soon as I set your first PS1 variable, my window title changes. So there must be something inside it that does that. I just don't know yet what it is. Actually it was obvious because if your window title contains the current directory, it must be set with each prompt.

Edit: It's probably the very beginning with the \e]0 and more stuff around it. When I remove that, my window title isn't affected by the prompt anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants