| Page 1 of 1 | [ 5 posts ] |
|
Hi, is there any chance I could turn off the error messages (java exceptions) being displayed on parse errors for example? I'm looking for something like "--silent" flag...
Thanks. |
|
I think there might not be a -q, --quiet, -s, or --silent option (as far as I can see) on ideological principle. If you have an error that's not recoverable you would probably want to know about it.
However, you can simply ignore stderr stream if you really want (not recommended). In bash it'd be something like this: Code: /path/to/yuicompressor-x.y.x.jar --type js errors_in_here.js 2>/dev/null All the info/log/error messages are sent to System.err (as are printStackTrace), so this is kinda safe if you really really want to not show errors for some reason (it seems System.out is only used if an output stream isn't specified). I recommend simply fixing the problems, though (but this is easier said than done, perhaps?). Last edited by danbeam on Mon Feb 28, 2011 10:22 am, edited 1 time in total. |
|
Hi Dan, thank you.
Thing is, I am building a php wrapper on top of yuicompressor. You are right, I definitely want to know whether it was successful or not. And I do know it by checking the return value of the php's "exec" function. And on error I'm throwing php exception. But on javascript parse errors it is not just returning failure, but also displaying the native java exceptions and I was unable to hide them even with using output buffer... I thought about >dev/null but as this is part of a library, I'd like to have it work on windows as well. BTW, is there something similar to >dev/null on win? Anyway, it's not that critical, it's more of a cosmetic issue... Thanks. |
|
Dan, my bad... I didn't realize the exceptions are sent to the stderr stream, I was catching the stdout only. Works well now.
|
|
Also, if you're still trying to detect a non-zero exit status (almost always meaning an error occurred), if you look at exec()'s third parameter (http://us2.php.net/manual/en/function.exec.php):
Code: return_var If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable. You can pass a variable by reference and it will (as long as you've specified the second argument as well) be written with the exit status from the command. |
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group