Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gcloud.cmd to invoke gcloud on Windows #113

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/gcloud_authorized_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl TokenProvider for GCloudAuthorizedUser {
}

fn run(cmd: &[&str]) -> Result<String, Error> {
let mut command = Command::new("gcloud");
let mut command = Command::new(GCLOUD_CMD);
command.args(cmd);

let mut stdout = match command.output() {
Expand All @@ -75,6 +75,12 @@ fn run(cmd: &[&str]) -> Result<String, Error> {
String::from_utf8(stdout).map_err(|_| Error::Str("output from `gcloud` is not UTF-8"))
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
const GCLOUD_CMD: &str = "gcloud";

#[cfg(target_os = "windows")]
const GCLOUD_CMD: &str = "gcloud.cmd";

/// The default number of seconds that it takes for a Google Cloud auth token to expire.
/// This appears to be the default from practical testing, but we have not found evidence
/// that this will always be the default duration.
Expand Down