Merge lp://qastaging/~cmiller/desktopcouch/add-port-getting-program into lp://qastaging/desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://qastaging/~cmiller/desktopcouch/add-port-getting-program
Merge into: lp://qastaging/desktopcouch
Diff against target: 44 lines (+40/-0)
1 file modified
bin/desktopcouch-get-port (+40/-0)
To merge this branch: bzr merge lp://qastaging/~cmiller/desktopcouch/add-port-getting-program
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Joshua Blount (community) Approve
Review via email: mp+20141@code.qastaging.launchpad.net

Commit message

Add a simple way for any language to get the communications port, by executing a program.

To post a comment you must log in.
Revision history for this message
Joshua Blount (jblount) :
review: Approve
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

looks ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'bin/desktopcouch-get-port'
--- bin/desktopcouch-get-port 1970-01-01 00:00:00 +0000
+++ bin/desktopcouch-get-port 2010-02-25 15:59:14 +0000
@@ -0,0 +1,40 @@
1#!/usr/bin/python
2# Copyright 2010 Canonical Ltd.
3#
4# This file is part of desktopcouch.
5#
6# desktopcouch is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Lesser General Public License version 3
8# as published by the Free Software Foundation.
9#
10# desktopcouch is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with desktopcouch. If not, see <http://www.gnu.org/licenses/>.
17#
18# Authors: Chad Miller <chad.miller@canonical.com>
19
20"""Return on stdout the port that the personal couchdb is listening on.
21As always, success returns a zero exit code, and an exception in Python
22returns an exit code of one. On error, stderr should have information
23useful for debugging."""
24
25import desktopcouch
26import sys
27import os
28
29devnull = open(os.devnull, "w")
30saved_stdout = sys.stdout
31try:
32 # Don't let any of our output interfere
33 sys.stdout = devnull
34 port = desktopcouch.find_port()
35finally:
36 sys.stdout = saved_stdout
37 devnull.close()
38
39print port
40

Subscribers

People subscribed via source and target branches