|
| 1 | +module Wasp.Node.Executables |
| 2 | + ( nodeExec, |
| 3 | + npmExec, |
| 4 | + npxExec, |
| 5 | + ) |
| 6 | +where |
| 7 | + |
| 8 | +import GHC.IO (unsafePerformIO) |
| 9 | +import StrongPath (fromAbsFile) |
| 10 | +import Wasp.Util.System (ExecName, resolveExecNameIO) |
| 11 | + |
| 12 | +-- | Node executable name to be passed to Haskell's "System.Process" functions. |
| 13 | +-- |
| 14 | +-- This function being top level form in combo with NOINLINE guarantees that IO action will get |
| 15 | +-- executed only once per lifetime of the Haskell program. |
| 16 | +{-# NOINLINE nodeExec #-} |
| 17 | +nodeExec :: ExecName |
| 18 | +nodeExec = |
| 19 | + -- NOTE: We are taking whole resolved absolute path here because just using the resolved exec name |
| 20 | + -- was still flaky on Windows in some situations. |
| 21 | + fromAbsFile $ snd $ unsafePerformIO $ resolveExecNameIO "node" |
| 22 | + |
| 23 | +-- | Npm executable name to be passed to Haskell's "System.Process" functions. |
| 24 | +-- |
| 25 | +-- This function being top level form in combo with NOINLINE guarantees that IO action will get |
| 26 | +-- executed only once per lifetime of the Haskell program. |
| 27 | +{-# NOINLINE npmExec #-} |
| 28 | +npmExec :: ExecName |
| 29 | +npmExec = |
| 30 | + -- NOTE: We are taking whole resolved absolute path here because just using the resolved exec name |
| 31 | + -- was still flaky on Windows in some situations. |
| 32 | + fromAbsFile $ snd $ unsafePerformIO $ resolveExecNameIO "npm" |
| 33 | + |
| 34 | +-- | Node executable name to be passed to Haskell's "System.Process" functions. |
| 35 | +-- |
| 36 | +-- This function being top level form in combo with NOINLINE guarantees that IO action will get |
| 37 | +-- executed only once per lifetime of the Haskell program. |
| 38 | +{-# NOINLINE npxExec #-} |
| 39 | +npxExec :: ExecName |
| 40 | +npxExec = |
| 41 | + -- NOTE: We are taking whole resolved absolute path here because just using the resolved exec name |
| 42 | + -- was still flaky on Windows in some situations. |
| 43 | + fromAbsFile $ snd $ unsafePerformIO $ resolveExecNameIO "npx" |
0 commit comments