Skip to content

dune exec --watch broken for long-running processes #12323

@royneary

Description

@royneary

Expected Behavior

For long-running processes like webservers, I'm normally starting dune exec --watch binary_name. Whenever I change a source code file, dune kills the running process, recompiles it and starts it again. This works with dune 3.19.1.

Actual Behavior

Since upgrading to dune 3.20.1, when changing the source code, the long-running process is not killed anymore. Recompilation only starts when the process exits on its own or I kill it manually.

Reproduction

  1. create a dune project with the following code in bin/main.ml:

    let () =
      for i = 20 downto 0 do
        Unix.sleep 1;
        print_endline (string_of_int i);
      done
    

    and the following bin/dune:

    (executable
      (public_name countdown)
      (name main)
      (libraries unix))
    
  2. start dune exec --watch countdown

  3. change bin/main.ml

The countdown continues until it reaches 0. Then recompilation starts and the process is started again.

Specifications

  • Version of dune (output of dune --version): 3.20.1
  • Version of ocaml (output of ocamlc --version): 5.3.0
  • Operating system (distribution and version): NixOS 25.05

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions