astrs-cli 0.1.0

The astrs command line: run, build, monitor, migrate and bridge robotic dataflows.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
//! The on-disk state `astrs up` creates and `astrs down`/`astrs status`
//! read: the runtime directory, the cluster token file, and one pidfile
//! per background process (blueprint §16, §24.2).
//!
//! ```text
//!   <working dir>/.astrs-token          64 hex, mode 0600      §16
//!   <runtime dir>/coordinator.pid       "<pid>\n<addr>\n"      §24.2
//!   <runtime dir>/daemon.pid            "<pid>\n<addr>\n"      §24.2
//!   <runtime dir>/daemon.sock           the node listener      §4.2
//!   <runtime dir>/build/<node>.log      `astrs build` capture  §17
//! ```
//!
//! # Why the token is not in the runtime directory
//!
//! Blueprint §16 is specific: *"64-hex cluster token
//! (`<working_dir>/.astrs-token`, 0600), generated by `astrs up`"*. The
//! runtime directory (§24.2) is per-*machine* and shared by every cluster
//! a user runs on it; the token is per-*cluster*. Putting it beside the
//! manifest is what lets a second cluster in a second directory have a
//! second token without either clobbering the other, and it is what makes
//! "check the token into your deployment directory, not your home" the
//! natural thing to do. Pidfiles go the other way for the same reason:
//! they describe *this machine's* processes, so they live in the runtime
//! directory and survive a user changing directories.
//!
//! # Everything here is inspectable without a cluster
//!
//! Each function takes explicit paths rather than reading the environment
//! for itself, so a test drives the whole lifecycle inside
//! [`std::env::temp_dir`] with no ambient state at all — see this module's
//! own tests.

use std::io::Write as _;
use std::path::{Path, PathBuf};

use astrs_wire::AuthToken;

use crate::error::CliError;

/// The file name blueprint §16 gives the cluster token.
pub const TOKEN_FILE: &str = ".astrs-token";

/// The environment variable that supplies a token when no file does.
pub const ENV_TOKEN: &str = "ASTRS_TOKEN";

/// The environment variable naming the coordinator's address.
pub const ENV_COORDINATOR_ADDR: &str = "ASTRS_COORDINATOR_ADDR";

/// The coordinator's pidfile, inside the runtime directory.
pub const COORDINATOR_PIDFILE: &str = "coordinator.pid";

/// The daemon's pidfile, inside the runtime directory.
pub const DAEMON_PIDFILE: &str = "daemon.pid";

/// The subdirectory `astrs build` captures per-node build logs into.
pub const BUILD_LOG_DIR: &str = "build";

/// The mode blueprint §16 requires on the token file: owner read/write,
/// nothing for anybody else.
///
/// Spelled as [`rustix::fs::Mode`] flags rather than an octal literal
/// because `mode_t` is `u16` on some targets and `u32` on others; the
/// flags carry their own width.
const TOKEN_MODE: rustix::fs::Mode = rustix::fs::Mode::RUSR.union(rustix::fs::Mode::WUSR);

/// The token file's mode as the octal a human reads in `ls -l`, for tests
/// and messages — the same bits the private `TOKEN_MODE` flags spell.
pub const TOKEN_MODE_OCTAL: u32 = 0o600;

/// The runtime directory to use, honoring an explicit override first.
///
/// Falls back to `astrs-daemon`'s own resolution — `ASTRS_RUNTIME_DIR`,
/// then `$XDG_RUNTIME_DIR/astrs`, then a per-uid temp directory (§24.2) —
/// so the CLI, the daemon it spawns and the daemon it embeds all agree on
/// one answer without the CLI re-deriving it.
#[must_use]
pub fn runtime_dir(explicit: Option<&Path>) -> PathBuf {
    explicit.map_or_else(
        astrs_daemon::config::paths::default_runtime_dir,
        Path::to_path_buf,
    )
}

/// The working directory a `.astrs-token` is looked up in.
///
/// The process's current directory when no override is given; a failure to
/// read it (a deleted cwd) degrades to `.` rather than aborting a verb
/// that may not need the token at all.
#[must_use]
pub fn working_dir(explicit: Option<&Path>) -> PathBuf {
    explicit.map_or_else(
        || std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),
        Path::to_path_buf,
    )
}

/// Creates `dir` if it does not exist.
///
/// # Errors
///
/// [`CliError::Io`] if the directory cannot be created.
pub fn ensure_dir(dir: &Path) -> Result<(), CliError> {
    std::fs::create_dir_all(dir).map_err(|source| CliError::io(dir, source))
}

/// The conventional token path for a working directory (§16).
#[must_use]
pub fn token_path(working_dir: &Path) -> PathBuf {
    working_dir.join(TOKEN_FILE)
}

/// Where a token came from, so an error can name it.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TokenSource {
    /// A `--token` argument.
    Argument,
    /// The [`ENV_TOKEN`] environment variable.
    Environment,
    /// A file on disk.
    File(PathBuf),
}

impl std::fmt::Display for TokenSource {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Argument => f.write_str("--token"),
            Self::Environment => f.write_str(ENV_TOKEN),
            Self::File(path) => write!(f, "{}", path.display()),
        }
    }
}

/// Finds the cluster token, in the order a user expects: the explicit
/// argument, then an explicit file, then [`ENV_TOKEN`], then
/// `<working_dir>/.astrs-token`.
///
/// Returns `Ok(None)` when nothing supplied one — a caller that can work
/// without authentication (probing a token-less development coordinator)
/// treats that as [`AuthToken::ZERO`], and one that cannot raises
/// [`CliError::NoToken`] itself, naming what it wanted.
///
/// # Errors
///
/// - [`CliError::Io`] if an explicitly named token file cannot be read.
/// - [`CliError::BadToken`] if what was found is not 64 hex digits.
pub fn find_token(
    argument: Option<&str>,
    file: Option<&Path>,
    working_dir: &Path,
) -> Result<Option<(AuthToken, TokenSource)>, CliError> {
    if let Some(text) = argument {
        return parse_token(text, TokenSource::Argument).map(Some);
    }
    if let Some(path) = file {
        // An explicitly named file that is missing is an error, unlike the
        // conventional one below: the user said where to look.
        let text = std::fs::read_to_string(path).map_err(|source| CliError::io(path, source))?;
        return parse_token(&text, TokenSource::File(path.to_path_buf())).map(Some);
    }
    if let Ok(text) = std::env::var(ENV_TOKEN)
        && !text.trim().is_empty()
    {
        return parse_token(&text, TokenSource::Environment).map(Some);
    }
    let conventional = token_path(working_dir);
    match std::fs::read_to_string(&conventional) {
        Ok(text) => parse_token(&text, TokenSource::File(conventional)).map(Some),
        Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(None),
        Err(source) => Err(CliError::io(&conventional, source)),
    }
}

/// Parses one 64-hex token, trimming the trailing newline a file has.
fn parse_token(text: &str, source: TokenSource) -> Result<(AuthToken, TokenSource), CliError> {
    AuthToken::parse_hex(text.trim())
        .map(|token| (token, source.clone()))
        .map_err(|error| CliError::BadToken {
            path: source.to_string(),
            source: error,
        })
}

/// Writes a freshly generated token to `<working_dir>/.astrs-token` at mode
/// `0600`, returning it and the path (§16).
///
/// Reuses the file that is already there when it holds a valid token, so a
/// second `astrs up` in the same directory keeps the token every daemon and
/// CLI on the machine has already been told.
///
/// # Errors
///
/// - [`CliError::Io`] if the file cannot be written or its mode set.
/// - [`CliError::BadToken`] if an existing file holds something unusable —
///   deliberately *not* overwritten, because silently replacing a token
///   would lock out every process still holding the old one.
pub fn ensure_token_file(working_dir: &Path) -> Result<(AuthToken, PathBuf), CliError> {
    let path = token_path(working_dir);
    if let Ok(text) = std::fs::read_to_string(&path) {
        let (token, _) = parse_token(&text, TokenSource::File(path.clone()))?;
        // The mode is re-applied even for an existing file: a token that
        // became world-readable (a careless `cp`, a permissive umask on an
        // earlier release) is exactly what §16 exists to prevent.
        set_owner_only(&path)?;
        return Ok((token, path));
    }
    ensure_dir(working_dir)?;
    let token = AuthToken::generate().map_err(|error| CliError::BadToken {
        path: path.display().to_string(),
        source: error,
    })?;
    write_private(&path, format!("{}\n", token.reveal_hex()).as_bytes())?;
    Ok((token, path))
}

/// Writes `token` to `path` at mode `0600` — the same private-write dance
/// [`ensure_token_file`] uses for the root token, exposed for callers that
/// already have a specific value to persist rather than one to generate or
/// reuse.
///
/// `astrs token mint --out` is the reason this exists: minting a read-scope
/// credential ([`astrs_coordinator::auth::derive_read_token`]) produces an
/// exact value the caller wants written down, which is a different contract
/// from [`ensure_token_file`]'s "generate a fresh one, or keep whatever is
/// already there" (§16) — reusing that function here would either silently
/// ignore the derived value or overwrite a root token a running coordinator
/// still depends on.
///
/// # Errors
///
/// [`CliError::Io`] if the directory cannot be created, or the file cannot
/// be written or its mode set.
pub fn write_token_file(path: &Path, token: &AuthToken) -> Result<(), CliError> {
    if let Some(parent) = path.parent()
        && !parent.as_os_str().is_empty()
    {
        ensure_dir(parent)?;
    }
    write_private(path, format!("{}\n", token.reveal_hex()).as_bytes())
}

/// Writes `bytes` to `path`, owner-only from the moment it exists.
///
/// The mode is applied to the temporary name *before* the rename, so the
/// token is never visible to another user even for the instant between
/// `create` and `set_permissions`.
fn write_private(path: &Path, bytes: &[u8]) -> Result<(), CliError> {
    let temporary = path.with_extension("tmp");
    {
        let mut file =
            std::fs::File::create(&temporary).map_err(|source| CliError::io(&temporary, source))?;
        set_owner_only(&temporary)?;
        file.write_all(bytes)
            .map_err(|source| CliError::io(&temporary, source))?;
        file.sync_all()
            .map_err(|source| CliError::io(&temporary, source))?;
    }
    std::fs::rename(&temporary, path).map_err(|source| CliError::io(path, source))
}

/// Applies mode `0600` to an existing file (§16).
fn set_owner_only(path: &Path) -> Result<(), CliError> {
    rustix::fs::chmod(path, TOKEN_MODE).map_err(|error| {
        CliError::io(
            path,
            std::io::Error::from_raw_os_error(error.raw_os_error()),
        )
    })
}

/// What a pidfile records: the process, and where it listens.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PidFile {
    /// The process id.
    pub pid: u32,
    /// The address it bound, when it announced one.
    pub addr: Option<String>,
}

impl PidFile {
    /// A record for a process that has not announced an address.
    #[must_use]
    pub const fn new(pid: u32) -> Self {
        Self { pid, addr: None }
    }

    /// A record for a process listening on `addr`.
    #[must_use]
    pub fn listening(pid: u32, addr: impl Into<String>) -> Self {
        Self {
            pid,
            addr: Some(addr.into()),
        }
    }

    /// The two-line text form: the pid, then the address (when known).
    ///
    /// Deliberately not JSON: `cat coordinator.pid` and `kill $(head -1 …)`
    /// are things operators do, and a pidfile that needs a parser to read
    /// is a pidfile that stops being useful the moment the CLI is what is
    /// broken.
    #[must_use]
    pub fn to_text(&self) -> String {
        match &self.addr {
            Some(addr) => format!("{}\n{addr}\n", self.pid),
            None => format!("{}\n", self.pid),
        }
    }

    /// Parses the text form, ignoring anything past the second line.
    #[must_use]
    pub fn parse(text: &str) -> Option<Self> {
        let mut lines = text.lines();
        let pid: u32 = lines.next()?.trim().parse().ok()?;
        let addr = lines
            .next()
            .map(str::trim)
            .filter(|line| !line.is_empty())
            .map(ToOwned::to_owned);
        Some(Self { pid, addr })
    }

    /// Whether the recorded process is still alive.
    ///
    /// A `kill(pid, 0)` probe: it answers "is there a process with this id
    /// that I could signal", which is exactly the question `astrs status`
    /// and `astrs down` ask. It cannot tell a recycled pid apart from the
    /// original, which is why [`crate::command::cluster`] confirms a
    /// *coordinator* by greeting it rather than by this alone.
    #[must_use]
    pub fn is_alive(&self) -> bool {
        let Ok(pid) = rustix::process::Pid::from_raw(self.pid.cast_signed()).ok_or(()) else {
            return false;
        };
        matches!(rustix::process::test_kill_process(pid), Ok(()))
    }
}

/// Writes a pidfile, creating its directory if needed.
///
/// # Errors
///
/// [`CliError::Io`] if the directory or the file cannot be written.
pub fn write_pidfile(path: &Path, record: &PidFile) -> Result<(), CliError> {
    if let Some(parent) = path.parent() {
        ensure_dir(parent)?;
    }
    std::fs::write(path, record.to_text()).map_err(|source| CliError::io(path, source))
}

/// Reads a pidfile, treating a missing or malformed one as "no process".
///
/// A malformed pidfile is *not* an error: a truncated write from a machine
/// that lost power should read as "nothing is running", which is the truth,
/// rather than as a failure that stops `astrs status` from reporting on the
/// other half of the cluster.
#[must_use]
pub fn read_pidfile(path: &Path) -> Option<PidFile> {
    let text = std::fs::read_to_string(path).ok()?;
    PidFile::parse(&text)
}

/// Deletes a pidfile, succeeding when it is already gone.
///
/// # Errors
///
/// [`CliError::Io`] for any failure other than "not found".
pub fn remove_pidfile(path: &Path) -> Result<(), CliError> {
    match std::fs::remove_file(path) {
        Ok(()) => Ok(()),
        Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()),
        Err(source) => Err(CliError::io(path, source)),
    }
}

/// The directory `astrs build` writes per-node logs into.
#[must_use]
pub fn build_log_dir(runtime_dir: &Path) -> PathBuf {
    runtime_dir.join(BUILD_LOG_DIR)
}

#[cfg(test)]
mod tests {
    #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

    use super::*;

    fn scratch(name: &str) -> PathBuf {
        let dir = std::env::temp_dir().join(format!(
            "astrs-cli-runtime-dir-{}-{name}",
            std::process::id()
        ));
        let _ = std::fs::remove_dir_all(&dir);
        std::fs::create_dir_all(&dir).unwrap();
        dir
    }

    /// A file's `rwx` bits, as [`rustix::fs::Mode`] flags.
    ///
    /// Compared as flags rather than as an octal number for the reason
    /// [`TOKEN_MODE`] is spelled as flags in the first place: `mode_t` is
    /// `u16` on some targets and `u32` on others, so any octal comparison
    /// needs a width conversion that is load-bearing on one half of the
    /// platforms and a no-op on the other. The mask drops the setuid,
    /// setgid and sticky bits `from_raw_mode` also carries, which
    /// [`TOKEN_MODE`] does not claim anything about.
    fn permission_flags(path: &Path) -> rustix::fs::Mode {
        use rustix::fs::Mode;
        let stat = rustix::fs::stat(path).unwrap();
        Mode::from_raw_mode(stat.st_mode)
            .intersection(Mode::RWXU.union(Mode::RWXG).union(Mode::RWXO))
    }

    /// [`TOKEN_MODE_OCTAL`] documents itself as "the same bits the private
    /// `TOKEN_MODE` flags spell", and the two are declared apart — so
    /// nothing but this pins them together. Compared as octal *text*
    /// rather than as numbers on purpose: `bits()` is `mode_t`, whose width
    /// differs by target, and that is the whole reason the two spellings
    /// exist.
    #[test]
    fn the_documented_octal_spells_the_mode_that_gets_set() {
        assert_eq!(
            format!("{:o}", TOKEN_MODE.bits()),
            format!("{TOKEN_MODE_OCTAL:o}")
        );
    }

    #[test]
    fn an_explicit_runtime_dir_wins_over_the_environment() {
        let explicit = PathBuf::from("/tmp/somewhere");
        assert_eq!(runtime_dir(Some(&explicit)), explicit);
    }

    #[test]
    fn the_default_runtime_dir_is_the_daemons_own() {
        assert_eq!(
            runtime_dir(None),
            astrs_daemon::config::paths::default_runtime_dir()
        );
    }

    #[test]
    fn a_generated_token_round_trips_and_is_owner_only() {
        let dir = scratch("token");
        let (token, path) = ensure_token_file(&dir).unwrap();
        assert_eq!(path, dir.join(TOKEN_FILE));
        assert_eq!(token.reveal_hex().len(), 64);

        let found = find_token(None, None, &dir).unwrap().unwrap();
        assert_eq!(found.0, token);
        assert_eq!(found.1, TokenSource::File(path.clone()));

        assert_eq!(permission_flags(&path), TOKEN_MODE);
    }

    #[test]
    fn write_token_file_persists_the_exact_value_given() {
        let dir = scratch("token-write-exact");
        let path = dir.join("read.token");
        let token = AuthToken::from_bytes([0x5A; 32]);

        write_token_file(&path, &token).unwrap();

        let (found, source) = find_token(None, Some(&path), &dir).unwrap().unwrap();
        assert_eq!(found, token);
        assert_eq!(source, TokenSource::File(path.clone()));
        assert_eq!(permission_flags(&path), TOKEN_MODE);
    }

    #[test]
    fn write_token_file_creates_a_missing_parent_directory() {
        let dir = scratch("token-write-nested");
        let path = dir.join("nested").join("deeper").join("read.token");
        let token = AuthToken::from_bytes([0x5B; 32]);

        write_token_file(&path, &token).unwrap();

        let (found, _) = find_token(None, Some(&path), &dir).unwrap().unwrap();
        assert_eq!(found, token);
    }

    #[test]
    fn a_second_up_reuses_the_token_already_on_disk() {
        let dir = scratch("token-reuse");
        let (first, _) = ensure_token_file(&dir).unwrap();
        let (second, _) = ensure_token_file(&dir).unwrap();
        assert_eq!(
            first, second,
            "regenerating would lock out every process holding the old one"
        );
    }

    #[test]
    fn a_corrupt_token_file_is_refused_rather_than_replaced() {
        let dir = scratch("token-corrupt");
        std::fs::write(token_path(&dir), "not a token").unwrap();
        let error = ensure_token_file(&dir).unwrap_err();
        assert!(matches!(error, CliError::BadToken { .. }), "{error}");
    }

    #[test]
    fn an_argument_beats_a_file() {
        let dir = scratch("token-argument");
        let (on_disk, _) = ensure_token_file(&dir).unwrap();
        let other = AuthToken::from_bytes([9; 32]);
        let found = find_token(Some(&other.reveal_hex()), None, &dir)
            .unwrap()
            .unwrap();
        assert_eq!(found.0, other);
        assert_ne!(found.0, on_disk);
        assert_eq!(found.1, TokenSource::Argument);
    }

    #[test]
    fn a_missing_conventional_token_is_not_an_error() {
        let dir = scratch("token-absent");
        assert!(find_token(None, None, &dir).unwrap().is_none());
    }

    #[test]
    fn a_missing_explicit_token_file_is_an_error() {
        let dir = scratch("token-explicit-absent");
        let path = dir.join("nowhere.token");
        let error = find_token(None, Some(&path), &dir).unwrap_err();
        assert!(matches!(error, CliError::Io { .. }), "{error}");
    }

    #[test]
    fn a_bad_argument_token_names_the_argument() {
        let dir = scratch("token-bad-argument");
        let error = find_token(Some("zz"), None, &dir).unwrap_err();
        match error {
            CliError::BadToken { path, .. } => assert_eq!(path, "--token"),
            other => panic!("expected BadToken, got {other}"),
        }
    }

    #[test]
    fn a_pidfile_round_trips_through_its_text_form() {
        let record = PidFile::listening(4242, "127.0.0.1:7407");
        let parsed = PidFile::parse(&record.to_text()).unwrap();
        assert_eq!(parsed, record);

        let bare = PidFile::new(7);
        assert_eq!(PidFile::parse(&bare.to_text()).unwrap(), bare);
    }

    #[test]
    fn a_malformed_pidfile_reads_as_nothing_running() {
        let dir = scratch("pidfile-malformed");
        let path = dir.join(COORDINATOR_PIDFILE);
        std::fs::write(&path, "\u{0}not a pid").unwrap();
        assert!(read_pidfile(&path).is_none());
    }

    #[test]
    fn writing_then_removing_a_pidfile_leaves_nothing_behind() {
        let dir = scratch("pidfile-lifecycle");
        let path = dir.join(DAEMON_PIDFILE);
        write_pidfile(&path, &PidFile::listening(std::process::id(), "uds")).unwrap();
        let read = read_pidfile(&path).unwrap();
        assert_eq!(read.pid, std::process::id());
        assert!(read.is_alive(), "this very process is alive");

        remove_pidfile(&path).unwrap();
        assert!(read_pidfile(&path).is_none());
        remove_pidfile(&path).expect("removing a gone pidfile is not an error");
    }

    #[test]
    fn a_pid_that_cannot_exist_is_not_alive() {
        // Pid 0 addresses "every process in my group" to `kill(2)`, so it is
        // never a live *process*; `Pid::from_raw` rejects it outright, which
        // is the path this asserts.
        assert!(!PidFile::new(0).is_alive());
    }

    #[test]
    fn the_build_log_directory_hangs_off_the_runtime_directory() {
        let dir = PathBuf::from("/run/astrs");
        assert_eq!(build_log_dir(&dir), dir.join(BUILD_LOG_DIR));
    }
}