Skip to content

Commit edec3b1

Browse files
committed
2 parents fd7d160 + 24dbfd4 commit edec3b1

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# simple-python-webserver-blueprint
22

3-
This is the blueprint example used for Cloudify's Intro section in our [Docs](http://docs.get-cloudify.org).
3+
This is the blueprint example used for Cloudify's Intro section in our [Docs](http://docs.getcloudify.org).
44

55
The blueprint runs a local Python SimpleHTTPServer and allows to tear it down as well and supports Linux,
66

install.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111

1212

1313
IS_WIN = os.name == 'nt'
14-
IS_DARWIN = (sys.platform == 'darwin')
1514

16-
# Get the port from the blueprint. We're running in the context of the
17-
# `http_web_server` node so we can read its `port` property.
15+
# Get the port from the blueprint. We're running this script in the context of
16+
# the `http_web_server` node so we can read its `port` property.
1817
PORT = ctx.node.properties['port']
1918

2019

@@ -26,18 +25,9 @@ def run_server():
2625
# The ctx object provides a built in logger.
2726
ctx.logger.info('Running WebServer locally on port: {0}'.format(PORT))
2827
# emulating /dev/null
29-
dn = open(os.devnull, 'wb')
30-
process = subprocess.Popen(webserver_cmd, stdout=dn, stderr=dn)
31-
32-
# we need this for linux because on linux process.pid is not accurate.
33-
# it provides somewhat arbitrary values.
34-
if not IS_WIN and not IS_DARWIN:
35-
del webserver_cmd[0]
36-
get_pid = ['pidof', '-s']
37-
get_pid.extend(webserver_cmd)
38-
return int(subprocess.check_output(get_pid))
39-
else:
40-
return process.pid
28+
with open(os.devnull, 'wb') as dn:
29+
process = subprocess.Popen(webserver_cmd, stdout=dn, stderr=dn)
30+
return process.pid
4131

4232

4333
def set_pid(pid):

0 commit comments

Comments
 (0)