{"comment":{"created_at":"2011-10-11T19:57:12Z","body":"You mean something like [warn_only](http://docs.fabfile.org/en/1.2.2/tutorial.html#failure-handling)? :)","updated_at":"2011-10-11T19:57:12Z","url":"https://api.github.com/repos/fabric/fabric/issues/comments/2370388","id":2370388,"user":{"avatar_url":"https://secure.gravatar.com/avatar/f1acc6318028fdba9874c77bc622a2fb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/bitprophet","id":6088,"login":"bitprophet"}},"action":"created","issue":{"number":449,"created_at":"2011-10-11T17:46:57Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"It would be nice if a flag could be passed to `run` (and friends) which says “I expect this command to return non-zero, so don't issue a warning or error if it appars to fail”.\r\n\r\nFor a simple example: I'd like to use `ping` to check if a host is up, but since `ping` returns non-zero if the host isn't up, this is difficult to do from Fabric (as it will either result in an exit, or issue an unnecessary warning).\r\n\r\nWould a patch adding an optional argument named something like `failure_ok` be considered?\r\n\r\nI imagine it would be used like this:\r\n\r\n    def check_host():\r\n        out = local(\"ping -t1 -W1 1.2.3.4 > /dev/null\", failure_ok=True)\r\n        if out.return_code == 0:\r\n            print \"the host is up\"\r\n        else:\r\n            print \"the host isn't up\"\r\n\r\nWhich would produce the output:\r\n\r\n    $ fab -f my_fabfile.py check_host\r\n    [localhost] local: ping -t1 -W1 1.2.3.4 > /dev/null\r\n    the host isn't up\r\n    \r\n    Done.\r\n\r\nInstead of the current, noisy, output:\r\n\r\n    $ fab -f my_fabfile.py check_host\r\n    [localhost] local: ping -t1 -W1 1.2.3.4 > /dev/null\r\n    \r\n    Warning: local() encountered an error (return code 2) while executing 'ping -t1 -W1 1.2.3.4 > /dev/null'\r\n    \r\n    the host isn't up\r\n    \r\n    Done.\r\n","comments":2,"title":"Flag to `run` allowing expected command failures","updated_at":"2011-10-11T19:57:12Z","url":"https://api.github.com/repos/fabric/fabric/issues/449","id":1878970,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/f0e286ba0482e57904e89e753a4b36e6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/wolever","id":59575,"login":"wolever"},"html_url":"https://github.com/fabric/fabric/issues/449","labels":[],"state":"open"},"legacy":{"issue_id":1878970,"comment_id":2370388}}