summaryrefslogtreecommitdiff
path: root/src/Wrapper.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wrapper.hs')
-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"