Commit Graph
16 Commits
Author SHA1 Message Date
Lars Wirzenius a688afde1f fix: references to types that were wrong 2026-08-04 11:49:27 +03:00
Lars Wirzenius e681fc8884 refactor: drop unnecessary result type for capture method 2025-12-11 19:34:18 +02:00
Lars Wirzenius beaf6221c0 feat: terminate a CI run 2025-11-24 13:08:55 +02:00
Lars Wirzenius 6bcf814004 chore: format code
Because we now use edition 2024, the default formatting by rustfmt is
different. Update the formatting, without any other changes, by running
`cargo fmt`.
2025-10-10 09:02:09 +03:00
Lars Wirzenius d49fd6cb2d fix: when adapter times out, return correct error variant
We need to handle "run failed for an intrinsic reason" differently
from "run didn't finish in time".

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-09-09 12:27:17 +03:00
Lars Wirzenius 27317200c1 fix: max_run_time setting in cib
The cib configuration setting max_run_time didn't always work, because
its implementation only killed the adapter, not any child processes of
the adapter. We fix this by running the adapter in its own process
group, and killing the whole group if the time runs out.

In addition, the timeoutcmd.rs module (and the ChildProcess type) is
simplified, by making the deadline mandatory. It is no longer possible
to run an adapter without a timeout. This makes sense, as it'd not be
useful to allow an adapter to run indefinitely. The old behavior can
be simulated by setting a very long timeout, such as a year.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-09-01 11:49:56 +03:00
Lars Wirzenius b3898f653f fix: make reading child output not block forever, if there is none
Spawn a thread that sleeps until timeout, then notifies the
RealtimeLines condition variable, which wakes up the reader thread and
lets it eventually finish.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-08-19 17:17:03 +03:00
Lars Wirzenius ac9261bb8e fix: make RealtimeLines::line honor the max duration setting
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-08-18 19:02:53 +03:00
Lars Wirzenius 04cc070cc5 add unit test to expose RealtimeLines not timing out
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-08-18 18:31:23 +03:00
Lars Wirzenius 582bd54b73 refactor: drop commented-out constants
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-14 08:20:05 +03:00
Lars Wirzenius e494961227 refactor: drop unnecessary pragma for allowing dead code
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-14 08:06:48 +03:00
Lars Wirzenius 55023f2e4f refactor: rewrite the timeoutcmd module for simplicity
Feed child process stdin via a temporary file. This is simpler than
opening a pipe and spawning a thread that feeds the pipe, when it's
not full.

Capture child stderr into a buffer without trying to let the
caller (another thread) process it line by line. We don't seem to have
use for that, and this simplifies things a fair bit.

Simplify the capture of child stdout to use a simpler thread and data
structure, compared to the previous multi-thread setup. Splitting
stdout into lines is now done by the thread that consumes the lines,
making the code that captures it simpler.

Also update the timeout subcommand to work with the changes. Other
callers of this code aren't yet updated.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-13 09:02:12 +03:00
Fintan Halpenny 8cbc1fe313 refactor: change test shell commands
While setting up a Nix flake, a series of tests were failing due to shell
invocations. The falling were the changes required:

- Use `!#/bin/sh` instead of `!#/bin/bash`
- Use `$$` instead of `$BASHPID`
- Use `true` and `false` instead of `/bin/true` and `/bin/false`

It was also noted that the `git-remote-helper` is needed alongside the `rad`
binary for some of the acceptance tests to work.
2025-01-24 10:23:49 +00:00
Lars Wirzenius fda28dbaae fix(src/timeoutcmd.rs): say stderr, instead of stdout
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-08 13:47:56 +02:00
Lars Wirzenius f3b83c30d8 feat: drop timeoutcmd.rs log messages to trace level
Also move them to logger.rs.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-12 09:19:45 +02:00
Lars Wirzenius 68f392dd78 feat: add a module to run a sub-process with a time limit
Also, capture its stdout and stderr.
2024-11-06 16:23:51 +02:00