suppress-warnings

suppress shell script error messages

流过昼夜 提交于 2019-11-29 00:21:26
问题 In my shell script I got these lines: rm tempfl.txt rm tempfl2.txt If these do not exist I get the error messages: rm: tempfl2.txt: No such file or directory rm: tempfl.txt: No such file or directory Is there a way to only suppress these messages even though they do not always appear, as the files might exist? 回答1: You have two options: Suppress rm warnings $ rm tempfl.txt 2> /dev/null Redirect script output to /dev/null $ ./myscript.sh 2> /dev/null The latter has a drawback of missing all

How to eliminate external lib/third party warnings in GCC [duplicate]

别说谁变了你拦得住时间么 提交于 2019-11-29 00:06:53
问题 This question already has answers here : How to suppress GCC warnings from library headers? (9 answers) Closed 4 years ago . In the software project I'm working on, we use certain 3rd party libraries which, sadly, produce annoying gcc warnings. We are striving to clean all code of warnings, and want to enable the treat-warnings-as-errors (-Werror) flag in GCC. Is there a way to make these 3rd party generated warnings, which we cannot fix, to disappear? 回答1: I presume you are talking about the

Suppress console output in PowerShell

风流意气都作罢 提交于 2019-11-28 22:21:34
I have a call to GPG in the following way in a PowerShell script: $key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose > $null I don't want any output from GPG to be seen on the main console when I'm running the script. Due to my noobness in PowerShell, I don't know how to do this. I searched Stack Overflow and googled for a way to do it, found a lot of ways to do it, but non of it worked. The "> $null" for example has no effect. I found the --quiet --no-verbose options for GPG to put less output in the console, still it's not completely quiet, and I'm sure there is a way in PowerShell

Exclude all permission denied messages from “du”

跟風遠走 提交于 2019-11-28 22:05:56
问题 I am trying to evaluate the disk usage of a number of Unix user accounts. Simply, I am using the following command: du -cBM --max-depth=1 | sort -n But I’ve seen many error message like below. How can I exclude all such “Permission denied” messages from display? du: `./james/.gnome2': Permission denied My request could be very similar to the following list, by replacing “find” to “du”. How can I exclude all "permission denied" messages from "find"? The following thread does not work. I guess

Is there an equivalent to SuppressWarnings in Scala?

瘦欲@ 提交于 2019-11-28 21:01:12
I was wondering if scala had an equivalent to java's @SuppressWarnings that can be applied to a function or whatever to ignore any deprecation warnings[1] that function emits? 1: Relevant warning in my case is: method stop in class Thread is deprecated: see corresponding Javadoc for more information. I am aware of the problems with stop however there are still some cases where due to legacy code we have to use it. retronym No, and an enhancement request [1] for such a feature was closed as wontfix . I agree it would be useful. I expect that the Scala core team aren't against the idea, but they

What do @SuppressWarnings(“deprecation”) and (“unused”) mean in Java?

柔情痞子 提交于 2019-11-28 19:03:36
What do these lines in my Java or Android project mean? @SuppressWarnings("deprecation") @SuppressWarnings("unused") The @SuppressWarnings annotation disables certain compiler warnings. In this case, the warning about deprecated code ( "deprecation" ) and unused local variables or unused private methods ( "unused" ). This article explains the possible values. One more thing: you can not only add them inline, but also annotate methods . F.ex. @Override @SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to supress a warning in PHP files for Netbeans?

两盒软妹~` 提交于 2019-11-28 09:57:59
问题 I have a PHP file with a line that produces a warning in the NetBeans. How can I force the IDE to ignore that concrete warning? Notice that I don't want to disable this type of warning solution-wide. Here is a sample line of code: if ($query = db_query("SELECT column FROM {table} WHERE type='some_value'")) { ... } Here is a text of produced warning: 'Possible accidental assignment, assignments in conditions should be avoided.' UPD: Dear colleagues, I know how to correct the code, but notice

How to suppress Java compiler warnings for specific functions

夙愿已清 提交于 2019-11-28 08:59:10
We are always taught to make sure we use a break in switch statements to avoid fall-through. The Java compiler warns about these situations to help us not make trivial (but drastic) errors. I have, however, used case fall-through as a feature (we don't have to get into it here, but it provides a very elegant solution). However the compiler spits out massive amounts of warnings that may obscure warnings that I need to know about. I know how I can change the compiler to ignore ALL fall-through warnings, but I would like to implement this on a method-by-method basis to avoid missing a place where

How do I fix Rubygems recent deprecation warning?

依然范特西╮ 提交于 2019-11-28 07:33:42
I have recently run updates: gem update --system gem update Now, I come with a lot of deprecation warnings each time I load a gem. For example, rails console : NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::Specification#default_executable= called from /Users/user/.rvm/gems/ruby-1.9.2-p180@global/specifications/rake-0.8.7.gemspec:10. NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::Specification#default_executable= called from /Users

Ignore divide by 0 warning in NumPy

旧城冷巷雨未停 提交于 2019-11-28 07:19:48
I have a function for statistic issues: import numpy as np from scipy.special import gamma as Gamma def Foo(xdata): ... return x1 * ( ( #R is a numpy vector ( ((R - x2)/beta) ** (x3 -1) ) * ( np.exp( - ((R - x2) / x4) ) ) / ( x4 * Gamma(x3)) ).real ) Sometimes I get from the shell the following warning: RuntimeWarning: divide by zero encountered in... I use the numpy isinf function to correct the results of the function in other files, so I do not need this warning. Is there a way to ignore the message? In other words, I do not want the shell to print this message. I do not want to disable all