Skip to content

Commit d8160a6

Browse files
authored
Add env var for worker path
1 parent 19e4124 commit d8160a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/bot/src/worker.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ struct Process {
120120

121121
impl Process {
122122
async fn spawn() -> anyhow::Result<Self> {
123-
let child = std::process::Command::new("./worker")
123+
let worker_path = std::env::var_os("TYPST_BOT_WORKER_PATH").unwrap_or_else(|| "./worker".into());
124+
let child = std::process::Command::new(&worker_path)
124125
.stdin(Stdio::piped())
125126
.stdout(Stdio::piped())
126127
.stderr(Stdio::inherit())
127128
.spawn()
128-
.context("spawning worker process.\n\nthis is likely because you are trying to run the bot from a checkout of the repo and `worker` is a directory. you can fix this by changing the path to the worker binary to point to the worker binary in the cargo target directory. alternatively, follow the instructions in the README that describe how to set up a standalone installation.")?;
129+
.with_context(|| format!("spawning worker process (path={worker_path:?}).\n\ntry setting TYPST_BOT_WORKER_PATH to point to the worker binary, e.g. in the cargo target directory. alternatively, follow the instructions in the README that describe how to set up a standalone installation.")?;
129130

130131
let mut ret = Self { child: Some(child) };
131132
// Ask for the version and ignore it, as a health check.

0 commit comments

Comments
 (0)