diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fec17ad..040e3c2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,7 +5,10 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v1 diff --git a/src/impl.rs b/src/impl.rs index 2b2e5db..f1dbb17 100644 --- a/src/impl.rs +++ b/src/impl.rs @@ -554,7 +554,8 @@ impl NpmBuild { /// Executes `npm install`. pub fn install(self) -> io::Result { - if let Err(e) = Command::new(&self.executable) + if let Err(e) = self + .command() .arg("install") .current_dir(&self.package_json_dir) .status() @@ -568,7 +569,8 @@ impl NpmBuild { /// Executes `npm run CMD`. pub fn run(self, cmd: &str) -> io::Result { - if let Err(e) = Command::new(&self.executable) + if let Err(e) = self + .command() .arg("run") .arg(cmd) .current_dir(&self.package_json_dir) @@ -591,6 +593,20 @@ impl NpmBuild { pub fn to_resource_dir(self) -> ResourceDir { self.into() } + + #[cfg(not(windows))] + fn command(&self) -> Command { + Command::new(&self.executable) + } + + #[cfg(windows)] + fn command(&self) -> Command { + let mut cmd = Command::new("cmd"); + + cmd.arg("/c").arg(&self.executable); + + cmd + } } impl From for ResourceDir {