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

Fix post-install script when project lives on a path with spaces #965

Merged
merged 1 commit into from
Oct 2, 2018

Conversation

bltavares
Copy link
Contributor

We found out that a project that lives under a path with spaces make the
post-install script fail. Our CI checks the project under ~/Application Support/project which makes the script throw an error.

> detox@8.2.3 postinstall /Users/bruno/Go
Agent/mobile/node_modules/detox
> node scripts/postinstall.js

+ xcodebuild -version
+++ dirname /Users/bruno/Go
Agent/mobile/node_modules/detox/scripts/build_framework.ios.sh
usage: dirname path
++ dirname
usage: dirname path
+ detoxRootPath=
child_process.js:632
throw err;
^

Error: Command failed: /Users/bruno/Go
Agent/mobile/node_modules/detox/scripts/build_framework.ios.sh

This is caused by the argument expansion on shell to think it is taking
more arguments than it should. The strategy is to use quotes on shell
scripts when refering to paths, such as "$var".

This commit wraps the variables refering to paths into quotes to avoid
the argument split when expanding.

Related to:

We found out that a project that lives under a path with spaces make the
post-install script fail. Our CI checks the project under `~/Application Support/project` which makes the script throw an error.

```
> detox@8.2.3 postinstall /Users/bruno/Go
Agent/mobile/node_modules/detox
> node scripts/postinstall.js

+ xcodebuild -version
+++ dirname /Users/bruno/Go
Agent/mobile/node_modules/detox/scripts/build_framework.ios.sh
usage: dirname path
++ dirname
usage: dirname path
+ detoxRootPath=
child_process.js:632
throw err;
^

Error: Command failed: /Users/bruno/Go
Agent/mobile/node_modules/detox/scripts/build_framework.ios.sh
```

This is caused by the argument expansion on shell to think it is taking
more arguments than it should. The strategy is to use quotes on shell
scripts when refering to paths, such as `"$var"`.

This commit wraps the variables refering to paths into quotes to avoid
the argument split when expanding.

Related to:
- wix#824
@bltavares bltavares requested a review from rotemmiz as a code owner October 2, 2018 17:38
@rotemmiz
Copy link
Member

rotemmiz commented Oct 2, 2018

Thanks!

@rotemmiz rotemmiz merged commit 9484757 into wix:master Oct 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants