aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 6f97737e..524145fa 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -28,7 +28,10 @@ class WindowsPopen:
self.stderr_ = PIPE
# Call the process with fixed streams.
- self.process = subprocess.Popen(args, bufsize, executable, self.stdin_, self.stdout_, self.stderr_, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
+ try:
+ self.process = subprocess.Popen(args, bufsize, executable, self.stdin_, self.stdout_, self.stderr_, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
+ except Exception, e:
+ print >> sys.stderr, 'subprocess.Popen(args=%s) failed! Exception %s' % (' '.join(args), str(e))
def communicate(self, input=None):
output = self.process.communicate(input)
@@ -822,14 +825,25 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
# 8k is a bit of an arbitrary limit, but a reasonable one
# for max command line size before we use a respose file
response_file = None
- if len(' '.join(link_cmd)) > 8192:
+ if WINDOWS and len(' '.join(link_cmd)) > 8192:
if DEBUG: print >>sys.stderr, 'using response file for llvm-link'
[response_fd, response_file] = mkstemp(suffix='.response', dir=TEMP_DIR)
+
+ link_cmd = [LLVM_LINK, "@" + response_file]
+
response_fh = os.fdopen(response_fd, 'w')
for arg in actual_files:
- response_fh.write(arg + "\n")
+ # we can't put things with spaces in the response file
+ if " " in arg:
+ link_cmd.append(arg)
+ else:
+ response_fh.write(arg + "\n")
response_fh.close()
- link_cmd = [LLVM_LINK, "@" + response_file, '-o', target]
+ link_cmd.append("-o")
+ link_cmd.append(target)
+
+ if len(' '.join(link_cmd)) > 8192:
+ print >>sys.stderr, 'emcc: warning: link command line is very long, even with response file -- use paths with no spaces'
output = Popen(link_cmd, stdout=PIPE).communicate()[0]