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

Fixed broken au run command for Windows #1206

Merged
merged 9 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ dist
/coverage
/package-lock.json
/yarn.lock
.npmrc
.npmrc
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ The `au new` command now simplify wraps `npx makes aurelia/v1`. Users can direct
1. Clone the aurelia-cli: `git clone https://github.com/aurelia/cli.git`
2. Go into the cli directory: `cd cli`
3. Run `npm install`
4. Run build `npm run build`
5. Link the cli with: `npm link`
6. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project.
7. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run`
4. Link the cli with: `npm link`
5. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project.
6. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run`

## Running the Tests

Expand Down
10 changes: 8 additions & 2 deletions lib/package-managers/base-package-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {spawn} = require('child_process');
const npmWhich = require('npm-which');
const isWindows = process.platform === "win32";

exports.BasePackageManager = class {
constructor(executableName) {
Expand All @@ -11,11 +12,16 @@ exports.BasePackageManager = class {
}

run(command, args = [], workingDirectory = process.cwd()) {
let executable = this.getExecutablePath(workingDirectory);
if (isWindows) {
executable = JSON.stringify(executable); // Add quotes around path
}

return new Promise((resolve, reject) => {
this.proc = spawn(
this.getExecutablePath(workingDirectory),
executable,
[command, ...args],
{ stdio: 'inherit', cwd: workingDirectory }
{ stdio: "inherit", cwd: workingDirectory, shell: isWindows }
)
.on('close', resolve)
.on('error', reject);
Expand Down
Loading