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

Ensure cross platform capability for exec CLI command #174

Closed
Robdel12 opened this issue Apr 29, 2019 · 0 comments · Fixed by #175
Closed

Ensure cross platform capability for exec CLI command #174

Robdel12 opened this issue Apr 29, 2019 · 0 comments · Fixed by #175

Comments

@Robdel12
Copy link
Contributor

The problem

The Percy Agent exec command basically wraps another command to smartly start/stop a Percy build. We currently use spawn to run the command they pass from the CLI, but this doesn't quite work as nicely on Windows. Given this command on a unix machine:

$ percy exec -- cypress run

It would have to be modified to run on Windows:

$ percy exec -- cypress.cmd run

Possible fix

It would be nice to explore something like shelljs to move us away from using spawn and managing these complexities ourself. Cypress uses execa: https://www.npmjs.com/package/execa

Robdel12 added a commit that referenced this issue Apr 30, 2019
This PR introduces cross platform spawning of commands. Will close #174. 

The problem is Windows users need to use the `exec` command like this: 
```
$ percy exec -- cypress.cmd run
``` 

If they don't, we can't spawn their original test command. What's happening is nodes `spawn` ignores windows `PATHEXT` which is kinda like `$PATH` & that means `spawn` only works on Windows for `.exe` files. See: 
- nodejs/node-v0.x-archive#2318
- bcoe/awesome-cross-platform-nodejs#26

Tested here: https://github.com/percy/example-percy-cypress/compare/rd/test-cross-platform

The first commit uses `cross_spawn` and successfully starts Cypress. The second commit uses `0.4.0` of agent and fails to start Cypress.
djones pushed a commit that referenced this issue Apr 30, 2019
## [0.4.1](v0.4.0...v0.4.1) (2019-04-30)

### Bug Fixes

* Introduce cross-spawn for cross platform commands ([#175](#175)) ([f9bc817](f9bc817)), closes [#174](#174)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant