summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-01-08 10:10:38 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2023-01-08 10:10:38 +0100
commit0252cec56760e25dd8a81c0c85bf4f8e6a5a36b5 (patch)
treeb5ddb4f7f45d5b14e139d8ec165fc7b3e8da12d9 /src
parent63fb0bfc26f42ba66c353e915e6e8219be679d07 (diff)
Look for core binary in PATH when invoked without path
Diffstat (limited to 'src')
-rw-r--r--src/Wrapper.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Wrapper.hs b/src/Wrapper.hs
index 64a2e0f..544e37c 100644
--- a/src/Wrapper.hs
+++ b/src/Wrapper.hs
@@ -1,5 +1,7 @@
module Main where
+import Control.Monad
+
import GHC.Environment
import System.Directory
@@ -24,7 +26,7 @@ main = do
callCommand "mount -t tmpfs tmpfs /run"
epath <- takeDirectory <$> getExecutablePath -- directory containing executable
- fpath <- map takeDirectory . take 1 <$> getFullArgs
+ fpath <- map takeDirectory . filter (any isPathSeparator) . take 1 <$> getFullArgs
-- directory used for invocation, can differ from above for symlinked executable
let dirs = concat
@@ -36,5 +38,8 @@ main = do
args <- getArgs
mapM_ (\file -> executeFile file False args Nothing) =<<
findExecutablesInDirectories dirs "erebos-tester-core"
+ when (null fpath) $
+ mapM_ (\file -> executeFile file False args Nothing) =<<
+ findExecutables "erebos-tester-core"
fail "core binary not found"