public
Last active

Silencing EC2 errors on Snow Leopard. Also see http://bit.ly/silencing-ec2

  • Download Gist
ec2-bin.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
To stop being annoyed by Java errors when using the EC2 API tools
on Snow Leopard, apply the following patch:
 
--- /ports/bin/ec2-cmd 2009-10-03 01:44:04.000000000 +0100
+++ /tmp/ec2-cmd 2009-10-03 01:44:54.000000000 +0100
@@ -58,4 +58,13 @@
CMD=$1
shift
-"$JAVA_HOME/bin/java" $EC2_JVM_ARGS $cygprop -classpath "$CP" com.amazon.aes.webservices.client.cmd.$CMD "$@"
+
+# to filter out the "deprecated" warnings introduced by Snow Leopard...
+exec 3>&1 # ... redirect fd3 to stdout
+exec 4>&2 # ... redirect fd4 to stderr
+
+# ... execute the java, sending stderr to stdout (so it gets grepped),
+# but stdout goes to fd3 (the preserved real stdout)
+# and the grepped output goes to fd4 (the preserved stderr)
+"$JAVA_HOME/bin/java" $EC2_JVM_ARGS $cygprop -classpath "$CP" com.amazon.aes.webservices.client.cmd.$CMD "$@" \
+ 2>&1 >&3 | grep -v '^\[Deprecated\] Xalan' >&4

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.