parse_line does not handle `rename:` events
Nobody has claimed this yet.
- Dominant language
- Gleam
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
It appears that watchexec recently started emitting `rename:` events when called with `--emit-events-to=stdio` (which the Gleam watchexec library uses) as of August 22: https://github.com/watchexec/watchexec/releases/tag/v2.6.0
The `parse_line` function in the Gleam watchexec library does not handle `rename:` events, and instead returns a `WatchexecUnexpectedOutput` error, for example:
```
WatchexecUnexpectedOutput("rename:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\ncreate:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nremove:/Users/jlubin/Repos/push_reload_server/hi.htmlsrEuDp.bck\nrename:/Users/jlubin/Repos/push_reload_server/hi.htmlsrEuDp.bck\n\nrename:/Users/jlubin/Repos/push_reload_server/hi.html\ncreate:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nmodify:/Users/jlubin/Repos/push_reload_server/hi.html\nremove:/Users/jlubin/Repos/push_reload_server/hi.htmlw2RznN.bck\nrename:/Users/jlubin/Repos/push_reload_server/hi.htmlw2RznN.bck\n\n")
```
Because `parse_line` returns an error, the `parse` function cuts off early and does not parse the rest of the events.
In addition to adding support for `rename:` events, perhaps the library should ignore events that it cannot parse so that if `watchexec` emits new events in the future, then the Gleam library will continue to work?
### Version info
I am running `watchexec` on macOS with the following version:
```
watchexec 2.7.0 (2026-08-24) +pid1
build-date: 2026-08-24
release: 2.7.0
features: default,pid1
```
Here are the packages I have installed for my Gleam project from `manifest.toml`:
```
packages = [
{ name = "alpacki", version = "3.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "alpacki", source = "hex", outer_checksum = "5BCB617A9606E56018790D4F24AB1E06B6D05BC17ACD6686B99E8D4D18B1F5FD" },
{ name = "ewe", version = "6.0.0", build_tools = ["gleam"], requirements = ["alpacki", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "logging", "websocks"], otp_app = "ewe", source = "hex", outer_checksum = "7DA49A6B5FF94D85D62B4EFE5054C505A1BED01763ACA08632F6FA2680BBDC90" },
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
{ name = "gleam_crypto", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "2DE9E4EF53CF6FEE049D4F765731F7178F7A11AEFAE00EEE63BF7536B354AD3F" },
{ name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" },
{ name = "gleam_http", version = "4.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "82EA6A717C842456188C190AFB372665EA56CE13D8559BF3B1DD9E40F619EE0C" },
{ name = "gleam_otp", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "DE4CA6850842F0266EE95317A25DD6A0A0F20CDFAB7C0ADC2E63251D7C3C72EC" },
{ name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
{ name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
{ name = "logging", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "BC5F18CE5DD9686100229FE5409BDC3DD5C46D5A7DF2F804AD2D8F0DD6C5060E" },
{ name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" },
{ name = "sceall", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "sceall", source = "hex", outer_checksum = "20DC648A610555561F4F65A354FD658CAE2275F16033D262186646EADAEE853B" },
{ name = "simplifile", version = "2.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A2727627B063E87351934C7F7F008F2D1FDB16F6DE0B8C79F9E46459CFC9C164" },
{ name = "watchexec", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib", "sceall"], otp_app = "watchexec", source = "hex", outer_checksum = "C73290CCE95687375B79971D4C20E8BAAF34AAA34B8D59EF276B6AD574B45880" },
{ name = "websocks", version = "4.0.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_stdlib"], otp_app = "websocks", source = "hex", outer_checksum = "89B0C31A032CBE28D4C5FB5CC25A8A690669FEBA501C63F99A4E8F5748750B2A" },
]
[requirements]
ewe = { version = ">= 6.0.0 and < 7.0.0" }
gleam_erlang = { version = ">= 1.3.0 and < 2.0.0" }
gleam_http = { version = ">= 4.3.0 and < 5.0.0" }
gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
logging = { version = ">= 1.5.0 and < 2.0.0" }
marceau = { version = ">= 1.3.0 and < 2.0.0" }
simplifile = { version = ">= 2.7.0 and < 3.0.0" }
watchexec = { version = ">= 1.1.0 and < 2.0.0" }
```
Thanks so much, lovely package!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the `parse_line` function and trace how `parse` handles its errors. Reproduce the supplied `rename:` output, then verify that rename events are handled and later events are not cut off; also establish the intended behavior for events the library cannot parse.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100