Skip to content

Commit

Permalink
fix: which command missing for windows (#417)
Browse files Browse the repository at this point in the history
* fix: which command missing for windows

Signed-off-by: campionfellin <[email protected]>

* fix import of os

Signed-off-by: campionfellin <[email protected]>

* fix: strict equality for platform

Signed-off-by: campionfellin <[email protected]>
  • Loading branch information
campionfellin authored Nov 25, 2020
1 parent ff5852c commit 38a7034
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/cdk8s-cli/templates/java-app/.hooks.sscaff.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { platform } = require('os');

const cli = require.resolve('../../bin/cdk8s');

exports.pre = (variables) => {
try {
execSync('which mvn');
execSync(`${platform() === 'win32' ? 'where' : 'which'} mvn`);
} catch {
console.error(`Unable to find "mvn". Install from https://maven.apache.org/install.html`);
process.exit(1);
Expand Down
9 changes: 5 additions & 4 deletions packages/cdk8s-cli/templates/python-app/.hooks.sscaff.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
const { execSync } = require('child_process');
const { chmodSync } = require('fs');
const { readFileSync } = require('fs');
const { platform } = require('os');

const cli = require.resolve('../../bin/cdk8s');

exports.pre = () => {
try {
execSync('which pipenv')
execSync(`${platform() === 'win32' ? 'where' : 'which'} pipenv`);
} catch {
console.error(`Unable to find "pipenv". Install from https://pipenv.kennethreitz.org`)
console.error(`Unable to find "pipenv". Install from https://pipenv.kennethreitz.org`);
process.exit(1);
}
try {
execSync('which pip3')
execSync(`${platform() === 'win32' ? 'where' : 'which'} pip3`);
} catch {
console.error(`Unable to find "pip3". Install from https://pip.pypa.io`)
console.error(`Unable to find "pip3". Install from https://pip.pypa.io`);
process.exit(1);
}
};
Expand Down

0 comments on commit 38a7034

Please sign in to comment.