git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2184 from phadej/2183-nodejs-fix
3629bd6Phil Freeman
tests/TestUtils.hs+10−1
@@ -12,6 +12,8 @@ import Control.Exception
12import System.Process
12import System.Process
13import System.Directory
13import System.Directory
14import System.Info
14import System.Info
15+import System.Exit (exitFailure)
16+import System.IO (stderr, hPutStrLn)
15
17
16findNodeProcess :: IO (Maybe String)
18findNodeProcess :: IO (Maybe String)
17findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
19findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
@@ -33,10 +35,17 @@ updateSupportCode = do
33 then callProcess "setup-win.cmd" []
35 then callProcess "setup-win.cmd" []
34 else do
36 else do
35 callProcess "npm" ["install"]
37 callProcess "npm" ["install"]
38+ -- bower uses shebang "/usr/bin/env node", but we might have nodejs
39+ node <- maybe cannotFindNode pure =<< findNodeProcess
36 -- Sometimes we run as a root (e.g. in simple docker containers)
40 -- Sometimes we run as a root (e.g. in simple docker containers)
37 -- And we are non-interactive: https://github.com/bower/bower/issues/1162
41 -- And we are non-interactive: https://github.com/bower/bower/issues/1162
38− callProcess "node_modules/.bin/bower" ["--allow-root", "install", "--config.interactive=false"]
42+ callProcess node ["node_modules/.bin/bower", "--allow-root", "install", "--config.interactive=false"]
39 setCurrentDirectory "../.."
43 setCurrentDirectory "../.."
44+ where
45+ cannotFindNode :: IO a
46+ cannotFindNode = do
47+ hPutStrLn stderr "Cannot find node (or nodejs) executable"
48+ exitFailure
40
49
41-- |
50-- |
42-- The support modules that should be cached between test cases, to avoid
51-- The support modules that should be cached between test cases, to avoid