# Odd \`exec\` node result using \`amixer -v'

**URL:** <https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963>\
**Category:** General\
**Created:** [23 May 2022 11:31 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963 "2022-05-23T11:31:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 11:31 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/1 "2022-05-23T11:31:58Z")

</div>

Node-RED running on a Pi Zero W v1.1  
Raspbian GNU/Linux 11 (bullseye) desktop version

Node-RED version: v2.2.2  
Node.js version: v14.19.1  
accessing NR from Mac Mini Safari

Using the `exec` node and sending the command 'amixer -v' the version comes back, BUT the exec node shows an error and says the command failed!

 ![Screen Shot 2022-05-23 at 7.06.58 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce002a9fb4122612e60fce45ab1a74118dc30ce5.png)

````auto
Here is the flow:
[{"disabled":false,"env":[],"id":"58ad38887591e1b1","info":"","label":"Flow 3","type":"tab"},{"active":true,"complete":"true","console":false,"id":"38409c9414d4fb0b","name":"stdout","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":[],"x":490,"y":80,"z":"58ad38887591e1b1"},{"active":true,"complete":"true","console":false,"id":"de852fbd07407b7a","name":"stderr","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":[],"x":490,"y":120,"z":"58ad38887591e1b1"},{"active":true,"complete":"true","console":false,"id":"42faac21ce0190b3","name":"return code","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":[],"x":510,"y":160,"z":"58ad38887591e1b1"},{"crontab":"","id":"84f238ce5b65227d","name":"","once":false,"onceDelay":0.1,"payload":"","payloadType":"date","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","topic":"","type":"inject","wires":[["17c3fba6aef9ee4f"]],"x":180,"y":120,"z":"58ad38887591e1b1"},{"addpay":"","append":"-v","command":"amixer ","id":"17c3fba6aef9ee4f","name":"","oldrc":false,"timer":"","type":"exec","useSpawn":"false","winHide":false,"wires":[["38409c9414d4fb0b"],["de852fbd07407b7a"],["42faac21ce0190b3"]],"x":330,"y":120,"z":"58ad38887591e1b1"}]```
````

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 May 2022 11:45 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/2 "2022-05-23T11:45:25Z")

</div>

Strangely, **amixer -v** does indeed give an exit value of 1 - an error indication.  
**amixer invalidparameter** gives an error message and an exit value of 0 !

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [23 May 2022 13:16 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/3 "2022-05-23T13:16:09Z")

</div>

This might (or might not) have some relevance

> [@Exec node can't execute the command but terminal does](https://discourse.nodered.org/t/exec-node-cant-execute-the-command-but-terminal-does/60892/11):
>
> It might not be a file path problem but make sure you've tested that all out 1st When running audio stuff from the exec node - you sometimes have to be explict about specifying what audio hardware to use. I play an mp3 via an exec node and had to add in lots of stuff to get it work mpg123 -a plughw:1,0 alexa.mp3 You might have to do something similar to hear your speech It took a lot of googling to find out how to get mine to work

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 15:23 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/4 "2022-05-23T15:23:54Z")

</div>

@cymplecy Simon, It's not a path problem because it actually returns the results. But as @jbudd pointed out, it looks like amixer bug when querying the version as both `amixer -v` and `amixer --version` rerturn an error (1) but also return the results.

Off to post a bug report on amixer!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 May 2022 18:58 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/5 "2022-05-23T18:58:01Z")

</div>

If anyone wants to follow this, the GitHub issue is here:

> <https://github.com/alsa-project/alsa-utils/issues/149>
>
> amixer version 1.2.4
> Raspberry Pi Zero W v1.1
> Raspbian GNU/Linux 11 (bullseye)… - desktop version
> Node-RED v2.2.2
> 
> This was discovered using an \`exec\` node in on a The exec node runs a command and returns its output. When running a test, I wanted to get the amixer version. There are two ways to ask \`amixer\` for it's version number
> 1 - use 'amixer -v'
> 2 - use 'amixer --version\`
> Both returned the version number but had a Return Code of 1. All other 'amixer' commands (like 'amixer -h\` or \`amixer --help') return with a '0'.
> 
> Here is a copy of the node-red flow that was used:
> 
> \`
> \[{"active":true,"complete":"true","console":false,"id":"38409c9414d4fb0b","name":"stdout","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":\[\],"x":730,"y":80,"z":"58ad38887591e1b1"},{"active":true,"complete":"true","console":false,"id":"de852fbd07407b7a","name":"stderr","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":\[\],"x":730,"y":120,"z":"58ad38887591e1b1"},{"active":true,"complete":"true","console":false,"id":"42faac21ce0190b3","name":"return code","statusType":"auto","statusVal":"","targetType":"full","tosidebar":true,"tostatus":false,"type":"debug","wires":\[\],"x":750,"y":160,"z":"58ad38887591e1b1"},{"crontab":"","id":"84f238ce5b65227d","name":"","once":false,"onceDelay":0.1,"payload":"amixer -v","payloadType":"str","props":\[{"p":"payload"},{"p":"topic","vt":"str"}\],"repeat":"","topic":"","type":"inject","wires":\[\["05c0a4eb46c0c1c8"\]\],"x":180,"y":60,"z":"58ad38887591e1b1"},{"crontab":"","id":"fabfd7b565392096","name":"","once":false,"onceDelay":0.1,"payload":"amixer -h","payloadType":"str","props":\[{"p":"payload"},{"p":"topic","vt":"str"}\],"repeat":"","topic":"","type":"inject","wires":\[\["05c0a4eb46c0c1c8"\]\],"x":180,"y":180,"z":"58ad38887591e1b1"},{"crontab":"","id":"c54064c5cc3b2484","name":"","once":false,"onceDelay":0.1,"payload":"amixer --version","payloadType":"str","props":\[{"p":"payload"},{"p":"topic","vt":"str"}\],"repeat":"","topic":"","type":"inject","wires":\[\["05c0a4eb46c0c1c8"\]\],"x":200,"y":120,"z":"58ad38887591e1b1"},{"addpay":"payload","append":"","command":"","id":"05c0a4eb46c0c1c8","name":"","oldrc":false,"timer":"","type":"exec","useSpawn":"false","winHide":false,"wires":\[\["38409c9414d4fb0b"\],\["de852fbd07407b7a"\],\["42faac21ce0190b3"\]\],"x":490,"y":120,"z":"58ad38887591e1b1"}\]
> \`

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [25 May 2022 06:10 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/6 "2022-05-25T06:10:36Z")

</div>

To reproduce on commandline (probably more useful for the reported issue):

```auto
pi@pi:~ $ amixer -v
amixer version 1.1.8
pi@pi:~ $ echo $?
1

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [25 May 2022 21:10 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/7 "2022-05-25T21:10:37Z")

</div>

@bakman2 thanks for that, I’ll add it to the GitHub issue!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [31 May 2022 13:28 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/8 "2022-05-31T13:28:35Z")

</div>

@jbudd @cymplecy @bakman2  
Just to let you all know that this was fixed in v1.2.5 but it's part of the asla\_utils package and that will have to be updated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 July 2022 13:29 UTC](https://discourse.nodered.org/t/odd-exec-node-result-using-amixer-v/62963/9 "2022-07-30T13:29:05Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
