-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use --print-id
with variable assignment
#1
Comments
To answer your off topic question, those warnings could absolutely be put behind the logging flag you established My brain's focused on other things ATM so IDK when if ever I'll get back to this. But you are right that those are obnoxious; especially when you're not in a position to upgrade the capabilities of an offending notification server or prevent an offending client from authoring Hypertext Markup notifications to a server that doesn't support it. |
I hope that having merged your PR puts this into an operable enough state for you for the time being. If you or someone else doesn't address it first, I'll try and eventually get back to it. |
Thanks for the explanations. In regards of the server capability warnings I've just opened issue #5 to track this separately, it's not really related to the Back to topic: As far as I understand your code right you're trying to write stdout and stderr to both a logfile and the original fds. With Bash and zsh this would be pretty easy ( #!/bin/bash
LOGFILE=foo
echo -n > $LOGFILE.1
echo -n > $LOGFILE.2
( tail -f $LOGFILE.1 ) &
( tail -f $LOGFILE.2 >&2 ) &
trap 'kill $(jobs -p)' 0
exec 1>>$LOGFILE.1
exec 2>>"$LOGFILE.2"
foo() {
echo "printing on stdout"
echo "printing on stderr" >&2
}
echo "pre function"
VAR="$(foo)"
echo "var = $VAR"
echo "post function" stdout and stderr might still get mixed up, but that's unavoidable I think. |
Using GNU Bash 4.4 on Ubuntu 18.04 (yes, legacy system, but still supported due to Ubuntu Pro, so... 🤷 I assume newer versions are affected as well) I can't use
--print-id
to assign the notification's ID to a variable.The following works as expected:
However, assigning the output (i.e. the notification's ID) to a variable fails:
The issue seems to be that you expect
/proc/$$/fd/1
and/proc/$$/fd/2
($FD1
and$FD2
variables in./src/notify-common.d/setup.sh
, lines 40+41) to always link to a path. However, this isn't true when the script's output is assigned to a variable; it's some magic value likepipe:[60224718]
then.I'm not entirely sure whether all this shell magic in
./src/notify-common.d/setup.sh
is even necessary? 🤔 It seems like (I'm not entirely sure though) that this (i.e. redirectingstdout
andstderr
to a logfile and then printing it again) is solely used for debugging purposes. Why not wrap the whole logfile logic inif $LOGGING; then …; fi
? That's exactly what I did locally and nothing seems to break. See pull request #2System info:
Off topic: Is there any other way to disable the warnings than piping
stderr
to/dev/null
?The text was updated successfully, but these errors were encountered: