Skip to content

Instantly share code, notes, and snippets.

@abriening
Created September 10, 2011 14:40
Show Gist options
  • Save abriening/1208374 to your computer and use it in GitHub Desktop.
Save abriening/1208374 to your computer and use it in GitHub Desktop.
Hijack a running nack_worker ( Pow server )
gem install hijack
ps aux | grep ruby
# andrew 10879 0.0 2.4 2538948 100668 ?? S 10:30AM 0:03.09 ruby .../node_modules/nack/bin/nack_worker .../config.ru /tmp/nack.56823.5122799426.sock
hijack 10879
# paste this into the running hijack session
class AppLogger
def initialize(app)
@app = app
end
def call(env)
$last_env = env
puts env.inspect
@app.call(env)
end
end
ActionController::Dispatcher.middleware.use AppLogger
# you will now see the rack env in the hijack session
# and have access to $last_env for inspection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment