ocaml / ocaml/dune

[RFC] allow user actions to request direct access to the terminal

Open
#3,464 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Dune systematically buffers the output of commands so that their output is not mixed up during parallel builds. However, this is not ideal for interactive commands that require direct access to the terminal.

Currently, the only workaround is to run dune with -j 1 --no-buffer which is not ideal since it completely disables parallelism and also require a specific dune invocation.

Another idea would be to let actions declare that they want direct access to the terminal.

Proposal

Add a new action (using_terminal ...) to introduce an action that requires the terminal. For instance:

(rule
 (alias runtest)
  (action (using_terminal (run ./prog.exe))))

Only one such action can run at a time, and while such an action is running messages emitted by dune would be put in a queue and rendered once the action has finished.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Dune's action execution and output-buffering behavior, then compare it with the proposed (using_terminal ...) action. Done means interactive actions can access the terminal directly, only one such action runs at a time, and Dune messages are queued until it finishes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.