web: disallow -f- which doesn't work (fixes #202)
hledger-web -f- gives [Error#yesod-core] <stdin>: hGetContents: illegal operation (handle is closed) and I can't see why. Just disallow it.
This commit is contained in:
		
							parent
							
								
									3fa3926ee9
								
							
						
					
					
						commit
						2c3f1b672e
					
				| @ -52,8 +52,14 @@ runWith opts | ||||
| 
 | ||||
| withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO () | ||||
| withJournalDo' opts cmd = do | ||||
|   -- XXX head should be safe for now | ||||
|   (head `fmap` journalFilePathFromOpts (cliopts_ opts)) >>= readJournalFile Nothing Nothing True >>= | ||||
|   f <- head `fmap` journalFilePathFromOpts (cliopts_ opts) -- XXX head should be safe for now | ||||
| 
 | ||||
|   -- https://github.com/simonmichael/hledger/issues/202 | ||||
|   -- -f- gives [Error#yesod-core] <stdin>: hGetContents: illegal operation (handle is closed) for some reason | ||||
|   -- Also we may be writing to this file. Just disallow it. | ||||
|   when (f == "-") $ error' "hledger-web doesn't support --f -, please specify a file path" | ||||
| 
 | ||||
|   readJournalFile Nothing Nothing True f >>= | ||||
|    either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts)) | ||||
| 
 | ||||
| -- | The web command. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user