Commit graph

17 commits

Author SHA1 Message Date
Uli Schlachter
4ce16084ff awesome-client: Handle errors when running arguments
Commit 78abb4a54c made awesome-client fail with a
non-zero exit code when sending a command that it got from stdin failed.

Commit f0f31bc305 added the possibility to specify
commands to run as arguments to awesome-client. However, the exit code was still
zero even when such a command failed.

This commit makes awesome-client signal errors with its exit code even for code
specified via arguments.

Note that this means that following arguments will not be executed if some
argument fails. I do not know if this is the best behaviour or not, but I am
implementing it like this here due to its simplicity to implement.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-08-31 17:44:43 +02:00
Fernando Vezzosi
f0f31bc305 awesome-client: send command line arguments to awesome (#1058)
In some languages, invoking commands with command-line arguments is
significantly simpler than setting up pipes for writing to a command's
standard input.

This adds an additional way for sending commands through awesome-client;
so all of these will be equivalent:

  $ awesome-client 'awesome.restart()'
  $ echo 'awesome.restart()' | awesome-client
  $ awesome-client <<<'awesome.restart()'
  $ awesome-client
  awesome# awesome.restart()
  awesome# ^D
  $

Note that this sends each command line argument as a separate message
over dbus.
2016-08-30 12:58:54 +02:00
Uli Schlachter
5db6c04c42 Add vim modelines to all shell scripts
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:36:35 +01:00
Daniel Hahler
7b233f3d37 awesome-client: do not send empty requests 2015-07-26 00:40:43 +02:00
Daniel Hahler
78abb4a54c Improved awesome-client: exit code, bash, prompt
- exit with a non-zero status code when dbus-send fails.
   If awesome does not respond to the D-Bus message, e.g. because it is not
   running (yet), awesome-client now returns with a non-zero return code.
   This can be used to check if awesome has finished starting up, which is
   meant to be used for the functional test runner.
 - changed the shebang to use bash directly, which simplifies the logic
   to detect/handle "bash as /bin/sh" and allows to use `set -o pipefail`
   (which makes handling the D-Bus error easier - without using a subshell).
 - fix the prompt: now with trailing space, and the prompt is actually used
   (which wasn't the case with /bin/sh not pointing at bash before).

Closes https://github.com/awesomeWM/awesome/pull/304.
2015-07-14 00:24:33 +02:00
Julien Danjou
7008d927f9 awesome-client: allow to send multi line code
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-12-16 11:55:51 +01:00
Julien Danjou
7d1fb8bcf5 Fix awesome-client parameters
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-11 10:01:28 +02:00
Julien Danjou
cbff5fe9dd awful: split D-Bus name from awesome
awful uses its own namespace in D-Bus

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-15 20:52:40 +02:00
Jonny Lamb
88be323e4a dbus: Use org.naquadah.awesome instead of org.awesome.
http://dbus.freedesktop.org/doc/dbus-specification.html#naming-conventions

Signed-off-by: Jonny Lamb <jonny@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-15 20:42:28 +02:00
Paweł Zuzelski
1fe239e577 unbash awesome-client
-e and -p options for read are bashizm, so awesome-client don't work
if /bin/sh is something other than bash (for example it fails with
pdksh which is default shell on PLD Linux).

The simplest sollution is 's,#!/bin/sh,#!/bin/bash,'. But I believe
that it is better to patch script so it will work with any POSIX
compliant shell.

Attached patch checks if shell is bash. If no it disables use of
non-standard read options.

I've also changed `` to $(), as backquotes are obsolete and
shouldn't be used.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-12 09:27:12 +02:00
Uli Schlachter
7bd08e683c awesome-client: Use /bin/sh instead of /bin/bash
All bashisms should be fixed (hopefully).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2009-05-10 10:54:27 +02:00
Uli Schlachter
b04aaa8ad5 awesome-client: Fix bashism
Signed-off-by: Uli Schlachter <psychon@znc.in>
2009-05-10 10:48:38 +02:00
Uli Schlachter
9e49865d3f awesome-client: Properly exit when dbus-send isn't found
Signed-off-by: Uli Schlachter <psychon@znc.in>
2009-05-10 10:48:27 +02:00
Julien Danjou
b38ebbeac1 awesome-client: use readline and no backslash
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-30 00:32:06 +02:00
Julien Danjou
4f1eac6fa5 awesome-client: we use bash extensions
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-30 00:26:53 +02:00
Uli Schlachter
b6db5137fc awesome-client: Use rlwrap if it is available
This should make this more usable again. The old C version used readline, if
possible and now the new bash version does too. :)

The idea to use rlwrap is from jd and it's a good one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2009-04-18 14:05:14 +02:00
Julien Danjou
f79cd42c33 import new awesome-client using D-Bus
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-08 17:30:18 +02:00