Skip to content

Commit

Permalink
Merge pull request #90 from kb2ma/develop_SW-167
Browse files Browse the repository at this point in the history
SW-167. Fix.
  • Loading branch information
twatteyne committed Oct 6, 2014
2 parents fb1d6f7 + 7b48160 commit 07b81de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions software/openvisualizer/bin/openVisualizerApp/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Provides rungui, runcli, and runweb targets.
import os
import subprocess
import sconsUtils
import signal

Import('env')

Expand Down Expand Up @@ -64,9 +65,14 @@ def uiRunner(target, source, env):
p = subprocess.Popen(argList, env=subEnv)

if env['WAIT_ON_UI']:
# Must wait for CLI program that uses raw_input(); otherwise
# Must wait for a program that uses raw_input(); otherwise
# SCons exits and standard input is sent to shell.
result = p.wait()

if (os.name == 'posix' and result == -signal.SIGTERM) \
or (os.name != 'posix' and result == signal.SIGTERM):
# Likely from console; not an error
result = 0
else:
# Display PID to make it easier to kill if necessary.
print 'Child PID is {0}'.format(p.pid)
Expand Down Expand Up @@ -156,6 +162,7 @@ cliEnv['HOSTOPT'] = None
cliEnv['PORTOPT'] = None
Alias('runcli', setupUiRunner(cliEnv, 'openVisualizerCli.py', []))

webEnv = env.Clone()
webdirs = ['web_files']
webEnv = env.Clone()
webdirs = ['web_files']
webEnv['WAIT_ON_UI'] = True
Alias('runweb', setupUiRunner(webEnv, 'openVisualizerWeb.py', webdirs))
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,5 @@ def _addParserArgs(parser):
input = raw_input('> ')
if input=='q':
print 'bye bye.'
app.close()
os.kill(os.getpid(), signal.SIGTERM)

0 comments on commit 07b81de

Please sign in to comment.