Skip to content

Open Windows console handle to retreive dimensions - #396

Merged
MisterDA merged 1 commit into
mainfrom
windows-open-console-for-dimensions
Oct 6, 2023
Merged

MisterDA merged 1 commit into
mainfrom
windows-open-console-for-dimensions

Conversation

@MisterDA

@MisterDA MisterDA commented Sep 26, 2023 •

Copy link
Copy Markdown
Collaborator

If stdout is redirected on Windows, the dimensions of the terminal won't be correctly retrieved. Open the console instead, using the special filename CONOUT$, and ask the dimensions of this handle. Keep a fallback to stdout if the console can't be opened, because you can never be too cautious with this OS.

(this is akin to opening /dev/tty on Unix).

https://learn.microsoft.com/en-us/windows/console/console-handles

If stdout is redirected on Windows, the dimensions of the terminal
won't be correctly retrieved. Open the console instead, using the
special filename CONOUT$, and ask the dimensions of this handle.
Keep a fallback to stdout if the console can't be opened.

https://learn.microsoft.com/en-us/windows/console/console-handles
@MisterDA
MisterDA force-pushed the windows-open-console-for-dimensions branch from 52e74ee to 81ce7d7 Compare September 27, 2023 11:23
@MisterDA
MisterDA merged commit 7cac1a3 into main Oct 6, 2023
@MisterDA
MisterDA deleted the windows-open-console-for-dimensions branch October 6, 2023 08:03
samoht added a commit to samoht/opam-repository that referenced this pull request Jul 25, 2024
CHANGES:

- Add `match_raises`, a generalized version of `check_raises`
  (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault)

- Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist)

- Fix division by zero when size of the terminal is incorrectly
  reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA)

- Enable terminal size reporting on macOS and Windows. Also report the
  terminal size even when the test is run buffered by Dune.
  (mirage/alcotest#381, mirage/alcotest#396, @MisterDA)

- Allow overriding the number of columns with `ALCOTEST_COLUMNS` env
  var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA)

- Be able to allocate and use user's formatters for stdout/stderr
  (mirage/alcotest#399, @dinosaure)

- Stop detecting ocamlci specifically, since there's nothing specific
  about it. Simply use the `CI` env var to detect CIs. Improve CI
  detection.
  (mirage/alcotest#397, @MisterDA)
Halbaroth pushed a commit to Halbaroth/opam-repository that referenced this pull request Jul 26, 2024
CHANGES:

- Add `match_raises`, a generalized version of `check_raises`
  (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault)

- Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist)

- Fix division by zero when size of the terminal is incorrectly
  reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA)

- Enable terminal size reporting on macOS and Windows. Also report the
  terminal size even when the test is run buffered by Dune.
  (mirage/alcotest#381, mirage/alcotest#396, @MisterDA)

- Allow overriding the number of columns with `ALCOTEST_COLUMNS` env
  var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA)

- Be able to allocate and use user's formatters for stdout/stderr
  (mirage/alcotest#399, @dinosaure)

- Stop detecting ocamlci specifically, since there's nothing specific
  about it. Simply use the `CI` env var to detect CIs. Improve CI
  detection.
  (mirage/alcotest#397, @MisterDA)
avsm pushed a commit to avsm/opam-repository that referenced this pull request Sep 5, 2024
CHANGES:

- Add `match_raises`, a generalized version of `check_raises`
  (mirage/alcotest#88, mirage/alcotest#386, @JoanThibault)

- Update JaneStreet core and async to v0.16 (mirage/alcotest#390 @tmcgilchrist)

- Fix division by zero when size of the terminal is incorrectly
  reported as zero. (fix mirage/alcotest#356, mirage/alcotest#381, @MisterDA)

- Enable terminal size reporting on macOS and Windows. Also report the
  terminal size even when the test is run buffered by Dune.
  (mirage/alcotest#381, mirage/alcotest#396, @MisterDA)

- Allow overriding the number of columns with `ALCOTEST_COLUMNS` env
  var. (mirage/alcotest#322, mirage/alcotest#381, @MisterDA)

- Be able to allocate and use user's formatters for stdout/stderr
  (mirage/alcotest#399, @dinosaure)

- Stop detecting ocamlci specifically, since there's nothing specific
  about it. Simply use the `CI` env var to detect CIs. Improve CI
  detection.
  (mirage/alcotest#397, @MisterDA)
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.

1 participant