Skip to content

Commit

Permalink
Fix --temp
Browse files Browse the repository at this point in the history
The new trigger code expects the working directory to be absolute, which
is the case for tempdirs but not necessarily `--temp`. Fix by
`.canonicalize()`ing the work dir.

Signed-off-by: Lann Martin <[email protected]>
  • Loading branch information
lann committed Sep 27, 2022
1 parent 340863c commit ff6f5db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/commands/up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ impl UpCommand {
None => WorkingDirectory::Temporary(tempfile::tempdir()?),
Some(d) => WorkingDirectory::Given(d.to_owned()),
};
let working_dir = working_dir_holder.path();
let working_dir = working_dir_holder.path().canonicalize()?;

let mut app = match (&self.app, &self.bindle) {
(app, None) => {
let manifest_file = app
.as_deref()
.unwrap_or_else(|| DEFAULT_MANIFEST_FILE.as_ref());
let bindle_connection = self.bindle_connection();
spin_loader::from_file(manifest_file, working_dir, &bindle_connection).await?
spin_loader::from_file(manifest_file, &working_dir, &bindle_connection).await?
}
(None, Some(bindle)) => match &self.server {
Some(server) => spin_loader::from_bindle(bindle, server, working_dir).await?,
Some(server) => spin_loader::from_bindle(bindle, server, &working_dir).await?,
_ => bail!("Loading from a bindle requires a Bindle server URL"),
},
(Some(_), Some(_)) => bail!("Specify only one of app file or bindle ID"),
Expand All @@ -149,7 +149,7 @@ impl UpCommand {
};

// Build and write app lock file
let locked_app = spin_trigger::locked::build_locked_app(app, working_dir)?;
let locked_app = spin_trigger::locked::build_locked_app(app, &working_dir)?;
let locked_path = working_dir.join("spin.lock");
let locked_app_contents =
serde_json::to_vec_pretty(&locked_app).context("failed to serialize locked app")?;
Expand Down

0 comments on commit ff6f5db

Please sign in to comment.