Skip to content

Instantly share code, notes, and snippets.

@norm
Created October 3, 2009 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norm/200283 to your computer and use it in GitHub Desktop.
Save norm/200283 to your computer and use it in GitHub Desktop.
Silencing EC2 errors on Snow Leopard. Also see http://bit.ly/silencing-ec2
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment