xbindkeys-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xbindkeys-devel] reading the output of run-command


From: Philippe Brochard
Subject: Re: [Xbindkeys-devel] reading the output of run-command
Date: Mon, 08 Jun 2009 21:44:17 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Marc Belmont writes:

> hi,
>
Hi,

> I wanted to read the output of run-command and I wrote this scheme code
> (define (shell-run cmd)
> (let* ((port (open-input-pipe cmd))
> (str (read-line port)))
> (close-port port)
> str))
>
I see nothing wrong with your code (expect maybe the indentation). And
it's in the guile manual.

> and then something like
> (xbindkey-function '(a) (lambda () (display (shell-run "xdotool 
> getmouselocation"))))
> it's working ok 5 times and then I get an error
> glibc detected *** xbindkeys: free(): invalid next size (fast): 0x80512a0 
> ***...
> What's wrong with my code?
>
Please, can you try this code directly with guile:

--------------------------------------------------
(use-modules (ice-9 popen))
(use-modules (ice-9 rdelim))

(define (shell-run cmd)
  (let* ((port (open-input-pipe cmd))
         (str (read-line port)))
    (close-port port)
    str))

(do ((i 0 (1+ i)))
    ((= i 1000))
  (display (shell-run "echo foo bar")))
--------------------------------------------------

Then with xbindkeys in the xbindkeysrc.scm but with no keys associated.

And then with a key associated. Something like this:

--------------------------------------------------
(xbindkey-function '(a) (lambda () 
                          (do ((i 0 (1+ i)))
                              ((= i 1000))
                            (display (shell-run "echo foo bar")))))
--------------------------------------------------

I'd like to see if the problem is in xbindkeys itself or if it comes
from guile.

Thanks for your feedback,

Philippe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]