diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-03 08:53:40 -0700 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-03 08:54:06 -0700 |
| commit | 43a67e310740e58707d0a7908237641ef46f5ae6 (patch) | |
| tree | 89df6bbb593bc85f8a443316c16dd4cd893f97d1 /src/Propellor/Shim.hs | |
| parent | f158d1cf81c2fe4ece5320dd725496043e5b953d (diff) | |
| parent | 776b4dc3b24f8d30fa0fe56254c16e613d8e0bbe (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Shim.hs')
| -rw-r--r-- | src/Propellor/Shim.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs index 7cdecefd..a3c8e701 100644 --- a/src/Propellor/Shim.hs +++ b/src/Propellor/Shim.hs @@ -55,12 +55,15 @@ shebang :: String shebang = "#!/bin/sh" checkAlreadyShimmed :: FilePath -> IO FilePath -> IO FilePath -checkAlreadyShimmed f nope = withFile f ReadMode $ \h -> do - fileEncoding h - s <- hGetLine h - if s == shebang - then return f - else nope +checkAlreadyShimmed f nope = ifM (doesFileExist f) + ( withFile f ReadMode $ \h -> do + fileEncoding h + s <- hGetLine h + if s == shebang + then return f + else nope + , nope + ) -- Called when the shimmed propellor is running, so that commands it runs -- don't see it. |
