[xmonad] Two dashes freeze shellPrompt

Dunric dunric29a at gmail.com
Thu Aug 18 22:02:16 CEST 2011


> On Thu, Aug 18, 2011 at 11:02:51AM +0200, Dunric wrote:
>> Hi,
>>
>> just took a peek into XMonad.Prompt.Shell source and found the cause
>> of dysfunction.
>> To get a list of possible command completions, shellPrompt makes use
>> of bash internal function "compgen" but end of options mark (yes, it
>> is the double-dash) is omitted.
>> So if completion function is supplied with "--", bash call cannot
>> finish because compgen expects another argument which never receives
>> so it hangs.
>>
>> +    f<- fmap lines $ runProcessWithInput "bash" [] ("compgen -A
>> file --" ++ encodeString s ++ "\n")
> Does there not need to be a space between the -- and the rest of the
> arguments?
>
> -Brent
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad

Sure, there should be a space after a double-dash. For a completeness 
sake corrected diff follows:

--- XMonad/Prompt/Shell.hs.orig    2011-08-18 10:26:24.816992530 +0200
+++ XMonad/Prompt/Shell.hs    2011-08-18 10:28:32.301992723 +0200
@@ -88,7 +88,7 @@
  getShellCompl :: [String] -> String -> IO [String]
  getShellCompl cmds s | s == "" || last s == ' ' = return []
                       | otherwise                = do
-    f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file " 
++ encodeString s ++ "\n")
+    f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file 
-- " ++ encodeString s ++ "\n")
      files <- case f of
                 [x] -> do fs <- getFileStatus x
                           if isDirectory fs then return [x ++ "/"]

Take care.

David




More information about the xmonad mailing list