Specifically calls to gpg.
具体调用gpg。
I'm having a hard time tracking down the problem as the logs don't give any output for these failing calls and they work perfectly from the production console.
我很难跟踪问题,因为日志没有为这些失败的调用提供任何输出,而且它们在生产控制台中工作得很好。
I've tried specifying the path to gpg:
我已经尝试指定到gpg的路径:
system "path/to/gpg --all -my --encryption -options
and have made sure that Passenger is running under the same user that I am entering the console as. I've also tried backticking and %x()ing the commands in search of a more verbose response.
并确保乘客在我进入控制台的同一用户下运行。我还尝试了倒叙和%x()命令搜索更详细的响应。
No luck. Prayer, dance and violence have proved equally useless.
没有运气。祈祷、舞蹈和暴力被证明同样无用。
2 个解决方案
#1
1
To help debug issues like this, you could try calling a bash script which handles logging of issues, instead of the command directly:
要帮助调试这样的问题,您可以尝试调用一个处理问题日志的bash脚本,而不是直接调用命令:
#!/bin/bash
# my_gpg_script.sh
set -e
set -u
set -x
set -v
path/to/gpg --all -my --encryption -options > /var/log/whats_happening.log
Then call system "my_gpg_script.sh"
from ruby.
然后调用系统”my_gpg_script。从ruby sh”。
#2
0
Lebreeze got me on the right path, but I could never get the STDOUT to redirect to my log and ended up having to debug by tracing the whole method as suggested over here https://serverfault.com/questions/98994/suppress-gpg-reading-passphrase-from-file-descriptor-0-message
Lebreeze让我找到了正确的路径,但是我无法让STDOUT重定向到我的日志,最后不得不通过跟踪整个方法进行调试,就像这里提到的https://serverfault.com/questions/9898994/- gpg-reading- passphras-files -descriptor- message
strace path/to/gpg --all -my --encryption -options 2>>/var/log/whats_happening.log
It turned out to be a path issue. I had naively thought that $PATH would be the same in the console and application as long as the environment and user were the same. Not the case. Adding some extra paths in my httpd.conf file fixed me up though.
这是一个路径问题。我曾天真地认为,只要环境和用户相同,在控制台和应用程序中$PATH就是相同的。不是这样的。在我的httpd中添加一些额外的路径。conf文件把我固定住了。
SetEnv PATH /this/bin:/that/other/bin:/and/dont/foget/bin
#1
1
To help debug issues like this, you could try calling a bash script which handles logging of issues, instead of the command directly:
要帮助调试这样的问题,您可以尝试调用一个处理问题日志的bash脚本,而不是直接调用命令:
#!/bin/bash
# my_gpg_script.sh
set -e
set -u
set -x
set -v
path/to/gpg --all -my --encryption -options > /var/log/whats_happening.log
Then call system "my_gpg_script.sh"
from ruby.
然后调用系统”my_gpg_script。从ruby sh”。
#2
0
Lebreeze got me on the right path, but I could never get the STDOUT to redirect to my log and ended up having to debug by tracing the whole method as suggested over here https://serverfault.com/questions/98994/suppress-gpg-reading-passphrase-from-file-descriptor-0-message
Lebreeze让我找到了正确的路径,但是我无法让STDOUT重定向到我的日志,最后不得不通过跟踪整个方法进行调试,就像这里提到的https://serverfault.com/questions/9898994/- gpg-reading- passphras-files -descriptor- message
strace path/to/gpg --all -my --encryption -options 2>>/var/log/whats_happening.log
It turned out to be a path issue. I had naively thought that $PATH would be the same in the console and application as long as the environment and user were the same. Not the case. Adding some extra paths in my httpd.conf file fixed me up though.
这是一个路径问题。我曾天真地认为,只要环境和用户相同,在控制台和应用程序中$PATH就是相同的。不是这样的。在我的httpd中添加一些额外的路径。conf文件把我固定住了。
SetEnv PATH /this/bin:/that/other/bin:/and/dont/foget/bin