diff options
Diffstat (limited to 'kiki.hs')
-rw-r--r-- | kiki.hs | 28 |
1 files changed, 0 insertions, 28 deletions
@@ -853,34 +853,6 @@ show_wip keyspec wkgrip db = do | |||
853 | let nwb = maybe 0x80 CryptoCoins.secretByteFromName $ snd s | 853 | let nwb = maybe 0x80 CryptoCoins.secretByteFromName $ snd s |
854 | putStrLn $ walletImportFormat nwb k | 854 | putStrLn $ walletImportFormat nwb k |
855 | 855 | ||
856 | -- | systemEnv | ||
857 | -- This is like System.Process.system except that it lets you set | ||
858 | -- some environment variables. | ||
859 | systemEnv _ "" = | ||
860 | ioException (ioeSetErrorString (mkIOError InvalidArgument "system" Nothing Nothing) "null command") | ||
861 | systemEnv vars cmd = do | ||
862 | env0 <- getEnvironment | ||
863 | let env1 = filter (isNothing . flip lookup vars . fst) env0 | ||
864 | env = vars ++ env1 | ||
865 | syncProcess "system" $ (shell cmd) {env=Just env} | ||
866 | where | ||
867 | -- This is a non-exported function from System.Process | ||
868 | syncProcess fun c = do | ||
869 | -- The POSIX version of system needs to do some manipulation of signal | ||
870 | -- handlers. Since we're going to be synchronously waiting for the child, | ||
871 | -- we want to ignore ^C in the parent, but handle it the default way | ||
872 | -- in the child (using SIG_DFL isn't really correct, it should be the | ||
873 | -- original signal handler, but the GHC RTS will have already set up | ||
874 | -- its own handler and we don't want to use that). | ||
875 | old_int <- installHandler sigINT Ignore Nothing | ||
876 | old_quit <- installHandler sigQUIT Ignore Nothing | ||
877 | (_,_,_,p) <- runGenProcess_ fun c | ||
878 | (Just defaultSignal) (Just defaultSignal) | ||
879 | r <- waitForProcess p | ||
880 | _ <- installHandler sigINT old_int Nothing | ||
881 | _ <- installHandler sigQUIT old_quit Nothing | ||
882 | return r | ||
883 | |||
884 | doExport doDecrypt (db,use_db) (fname,subspec,ms,cmd) = | 856 | doExport doDecrypt (db,use_db) (fname,subspec,ms,cmd) = |
885 | case ms of | 857 | case ms of |
886 | [_] -> export | 858 | [_] -> export |