Skip to content

Commit 0106940

Browse files
author
Bronson Quick
authored
Merge pull request #18 from Chassis/fix-path
Fix PATH used for running binaries
2 parents fb4110c + e6d400f commit 0106940

5 files changed

Lines changed: 22 additions & 3 deletions

File tree

config/webpack.config.dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ module.exports = {
9090
alias: {
9191
// Support React Native Web
9292
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
93-
'react-native': 'react-native-web'
93+
'react-native': 'react-native-web',
94+
'spawn-sync': path.join( paths.appSrc, 'lib', 'spawn-sync.js' ),
9495
}
9596
},
9697

config/webpack.config.prod.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ module.exports = {
8686
alias: {
8787
// Support React Native Web
8888
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
89-
'react-native': 'react-native-web'
89+
'react-native': 'react-native-web',
90+
'spawn-sync': path.join( paths.appSrc, 'lib', 'spawn-sync.js' ),
9091
}
9192
},
9293

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"case-sensitive-paths-webpack-plugin": "1.1.4",
1717
"chalk": "1.1.3",
1818
"connect-history-api-fallback": "1.3.0",
19-
"cross-spawn": "4.0.0",
2019
"css-loader": "0.24.0",
2120
"deepmerge": "^1.3.1",
2221
"detect-port": "1.0.0",
@@ -36,6 +35,7 @@
3635
"file-loader": "0.9.0",
3736
"filesize": "3.3.0",
3837
"find-cache-dir": "0.1.1",
38+
"fix-path": "^2.1.0",
3939
"font-awesome": "^4.6.3",
4040
"fs-extra": "0.30.0",
4141
"gzip-size": "3.0.0",

src/lib/configure.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Setup for global handlers.
33
*/
44
import ansiHTML from 'ansi-html';
5+
import fixPath from 'fix-path';
56
import which from 'which';
67

78
import * as actions from './actions';
@@ -22,6 +23,9 @@ export default store => {
2223
window.keyHandler = new Keys();
2324
window.keyHandler.listen( store );
2425

26+
// Fix the process.env path, which isn't inherited by the shell on macOS.
27+
fixPath();
28+
2529
if ( ! state.installer.installed.chassis ) {
2630
// Search for installed applications.
2731
which( 'vagrant', err => {

src/lib/spawn-sync.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// fix-path internally uses some modules, which at the end of the day use
2+
// cross-spawn.
3+
//
4+
// Internally, this uses child_process.spawnSync if available (Node 0.11+), but
5+
// conditionally loads the spawn-sync module for compatibility. However, webpack
6+
// complains if the module isn't available.
7+
//
8+
// We fake this via a webpack alias to this module, as we know the Electron
9+
// environment always has this available. This file could actually be left
10+
// blank because it's never loaded, but just in case another module is using it:
11+
12+
import child from 'child_process';
13+
export default child.spawnSync;

0 commit comments

Comments
 (0)