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

Allow execution of post-install scripts on paths with space #824

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

bltavares
Copy link
Contributor

We found that we where not able to install detox if the project is
installed on a path with spaces on parent directories.

For example, if we clone the project on ~/My Projects/my-project,
running npm install will fail to locate the detox/scripts/build_framework.ios.sh.

/bin/sh: /Users/me/My: No such file or directory
child_process.js:615
    throw err;
    ^

Error: Command failed: /Users/me/My Projects/my-project/node_modules/detox/scripts/build_framework.ios.sh
    at checkExecSyncError (child_process.js:575:11)

This is related to node's child_process handling of
filepaths on exec.

Instead of locating the file as ~/My Projects/my-project/node_modules/detox/scripts/build_framework.ios.sh, it passes the argument as ~/My and fails to execute.

This commit changes the execution process to threat the first argument as a file path, instead of arguments to exec, which triggers the split by space to determine the arguments.

We found that we where not able to install `detox` if the project is
installed on a path with spaces on parent directories.

For example, if we clone the project on `~/My Projects/my-project`,
running `npm install` will fail to locate the `detox/scripts/build_framework.ios.sh`.

```
/bin/sh: /Users/me/My: No such file or directory
child_process.js:615
    throw err;
    ^

Error: Command failed: /Users/me/My Projects/my-project/node_modules/detox/scripts/build_framework.ios.sh
    at checkExecSyncError (child_process.js:575:11)
```

This is related to [node's child_process](nodejs/node#6803) handling of
filepaths on `exec`.

Instead of locating the file as `~/My Projects/my-project/node_modules/detox/scripts/build_framework.ios.sh`, it passes the argument as `~/My` and fails to execute.

This commit changes the execution process to threat the first argument as a file path, instead of arguments to `exec`, which triggers the split by space to determine the arguments.

Co-Authored-By: Fellipe Chagas <fellipe.chagas@nubank.com.br>
Co-Authored-By: Rafael Correia <rafael.correia.poli@gmail.com>
@bltavares bltavares requested a review from rotemmiz as a code owner July 12, 2018 17:42
@noomorph
Copy link
Collaborator

Looks totally valid to me. @rotemmiz , what do you think?

@rotemmiz
Copy link
Member

Yes, looks good. Retriggered CI.

@noomorph noomorph merged commit 5028915 into wix:master Jul 19, 2018
@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants