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

Console title not being restored when process terminates #63

Closed
rksouthee opened this issue Oct 27, 2020 · 1 comment
Closed

Console title not being restored when process terminates #63

rksouthee opened this issue Oct 27, 2020 · 1 comment

Comments

@rksouthee
Copy link
Contributor

According to the documentation for SetConsoleTitle, when the process terminates the original title is restored. When running yori however, the title is not being restored.

C:\temp>ver
YoriLib version: 01.30
Yori shell version: 01.30
Build date: Jul 18 2020
C:\temp>title -g
Yori MSVC
C:\temp>type main.c
#include <Windows.h>

int main()
{
        SetConsoleTitle("new title");
        Sleep(1000);
}
C:\temp>cl /nologo main.c
main.c
C:\temp>main.exe
C:\temp>title -g
new title
C:\temp>
@malxau
Copy link
Owner

malxau commented Oct 27, 2020

The documentation in SetConsoleTitle is obviously wrong, which your program demonstrates. It never was the case that SetConsoleTitle is specific to a process. It's just that the shell may choose to alter the text later whenever it feels like it.

Yori gives you the choice: if you set the title via ytitle.exe, it's just arbitrary text set at some point in time that lasts until something changes it. If you set it via %YORITITLE%, it gets re-evaluated before each command. This allows the title to be highly dynamic, invoke child processes, etc. Obviously this behavior is more computationally expensive, but I assume it's what things like CMD are implicitly doing anyway.

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