Coder Social home page Coder Social logo

Comments (8)

andreban avatar andreban commented on September 28, 2024 1

Oh, indeed, I can see which was still there in 0.12.0. I can confirm it fails to find the gcloud command on 0.12.0 though. I'll keep looking into why it fails to find it.

from gcp_auth.

djc avatar djc commented on September 28, 2024 1

Sounds great, can you submit a PR?

from gcp_auth.

djc avatar djc commented on September 28, 2024

Do you want to try to revert #109 and see if that works for you? (I think if the removal of which is the cause, 0.12.0 should work for you since IIRC I only removed that in in 0.12.1.)

from gcp_auth.

andreban avatar andreban commented on September 28, 2024

Right, I wasn't pinning 0.12.0 correctly on my application's Cargo.toml. Once I pinned it correctly, the application worked. I confirmed this by checking out the 0.12.0 tag and running the simple example, then checking 0.12.1 and running the example. It succeeds on 0.12.0 and fails on 0.12.1. Re-adding the which code to 0.12.1 gets it working again. Happy to create a PR reverting the change, but wanted to check if there was another reason for removing the which dependency in the first place and other solution might be appropriate.

from gcp_auth.

djc avatar djc commented on September 28, 2024

I'm wondering, if you open a Command Prompt on Windows, can you successfully invoke Windows? I should probably also look at how which is implemented on Windows.

from gcp_auth.

djc avatar djc commented on September 28, 2024

I'm generally open to the idea of reverting the change that removed which but would like to understand why it's needed here. Maybe it could be a Windows-only dependency?

from gcp_auth.

andreban avatar andreban commented on September 28, 2024

It does work on the command line.

It turns out the problem is not the path, but the executable name. The actual executable name on Windows is gcloud.cmd. While, on the Command Prompt simply calling gcloud works and gcloud.cmd is invoked, that doesn't seems to be the case when spawning a process with Rust's Command.

So, this makes it work:

let mut command = Command::new("gcloud.cmd");

I think just moving the command name to OS specific variable should work:

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

...

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

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

from gcp_auth.

andreban avatar andreban commented on September 28, 2024

Created #113. Tested on Windows and MacOS.

from gcp_auth.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.