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

Disable VT mode if stdout is redirected #23

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Disable VT mode if stdout is redirected #23

merged 1 commit into from
Jun 20, 2024

Conversation

nmlgc
Copy link
Contributor

@nmlgc nmlgc commented Jun 20, 2024

read_cursor_pos() sends "\x1b[6n" to stdout and then expects to read the cursor position from stdin. This can never work if stdout is not a console, and causes MS-DOS Player to hang in an infinite loop in that case.

Since use_vt is set based on the Windows version and the -vt flag merely toggles this default, we also get different behavior depending on the OS: On Windows ≥10, msdos prog >NUL would hang and msdos prog -vt >NUL would run, but it's the other way around on earlier Windows versions.

`read_cursor_pos()` sends `"\x1b[6n"` to stdout and then expects to
read the cursor position from stdin. This can never work if stdout is
not a console, and previously caused MS-DOS Player to hang in an
infinite loop in that case.

Since `use_vt` is set based on the Windows version and the `-vt` flag
merely toggles this default, we also got different behavior depending
on the OS: On Windows ≥10, `msdos prog >NUL` would hang and
`msdos prog -vt >NUL` would run, but it's the other way around on
earlier Windows versions.
@nmlgc nmlgc changed the title Disable BT mode if stdout is redirected Disable VT mode if stdout is redirected Jun 20, 2024
@cracyc cracyc merged commit 8fe7085 into cracyc:vt Jun 20, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants