Skip to content

Commit

Permalink
Allow execution of post-install scripts on paths with space
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
3 people authored and noomorph committed Jul 19, 2018
1 parent ac4ea8d commit 5028915
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion detox/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (process.platform === "darwin") {
require("child_process").execSync(`${__dirname}/build_framework.ios.sh`, {
require("child_process").execFileSync(`${__dirname}/build_framework.ios.sh`, {
stdio: "inherit"
});
}

0 comments on commit 5028915

Please sign in to comment.