diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-08 10:10:38 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-08 10:10:38 +0100 |
commit | 0252cec56760e25dd8a81c0c85bf4f8e6a5a36b5 (patch) | |
tree | b5ddb4f7f45d5b14e139d8ec165fc7b3e8da12d9 | |
parent | 63fb0bfc26f42ba66c353e915e6e8219be679d07 (diff) |
Look for core binary in PATH when invoked without path
-rw-r--r-- | src/Wrapper.hs | 7 |
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" |