I have a shell script that uses xdotool to drive a GUI web browser.
It's been developed (by me) over a fairly long period of time, and it is
pretty well debugged. It does what it is supposed to do.
However, every once in a while, it generates the following sort of message:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3000001
Serial number of failed request: 371
Current serial number in output stream: 372
And here's the funny thing: the script is running with "set -e", so any
error (non-zero return) should cause the script to abort. However, when
the above message is displayed, there is no error abort. From this, I
conclude that xdotool isn't returning a non-zero status, even though
something has gone wrong.
In fact, what I think is going on is that Xlib (or some other low-level
library) is generating this message directly. Note that I also see this
message from time to time when running xev, so it is not unique to any
particular X app. Thus, as I say, it seems to be coming directly from the
library.
My main problem is that I can't tell which of the many invocations of
xdotool is causing this message to be displayed. Short of turning on
"set -x" mode in the script, which I do not want to do, I need a way to
detect which line in my script is causing the message to be displayed.
One way, and not a particularly bad idea, would be to wrap every call to
xdotool with Expect and watch for the string. I could probably do this,
but I'm posting here to see if anyone has any ideas for a better way.
Note, incidentally, that this error is not actually fatal. The script
still works - did what it was supposed to do - even though the message was
displayed. I would just like to know where it is coming from.
--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/InsaneParty