git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2184 from phadej/2183-nodejs-fix

Run bower thru node(js) executable

commit3629bd646c23e35542fedb01448e1832d87120f1 authorPhil Freeman <paf31@cantab.net> dateSun 5 Jun 2016, 11:24 (10 years ago) parente716ea59d653a7
1 file changed+10−1
tests/TestUtils.hs+10−1
tests/TestUtils.hs+10−1
@@ -12,6 +12,8 @@ import Control.Exception
1212import System.Process
1313import System.Directory
1414import System.Info
15+import System.Exit (exitFailure)
16+import System.IO (stderr, hPutStrLn)
1517
1618findNodeProcess :: IO (Maybe String)
1719findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
@@ -33,10 +35,17 @@ updateSupportCode = do
3335 then callProcess "setup-win.cmd" []
3436 else do
3537 callProcess "npm" ["install"]
38+ -- bower uses shebang "/usr/bin/env node", but we might have nodejs
39+ node <- maybe cannotFindNode pure =<< findNodeProcess
3640 -- Sometimes we run as a root (e.g. in simple docker containers)
3741 -- 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"]
3943 setCurrentDirectory "../.."
44+ where
45+ cannotFindNode :: IO a
46+ cannotFindNode = do
47+ hPutStrLn stderr "Cannot find node (or nodejs) executable"
48+ exitFailure
4049
4150-- |
4251-- The support modules that should be cached between test cases, to avoid