diff options
-rw-r--r-- | src/library_tty.js | 32 | ||||
-rw-r--r-- | tools/shared.py | 19 |
2 files changed, 28 insertions, 23 deletions
diff --git a/src/library_tty.js b/src/library_tty.js index 53239989..bf4a2472 100644 --- a/src/library_tty.js +++ b/src/library_tty.js @@ -6,23 +6,25 @@ mergeInto(LibraryManager.library, { $TTY: { ttys: [], init: function () { - if (ENVIRONMENT_IS_NODE) { - // currently, FS.init does not distinguish if process.stdin is a file or TTY - // device, it always assumes it's a TTY device. because of this, we're forcing - // process.stdin to UTF8 encoding to at least make stdin reading compatible - // with text files until FS.init can be refactored. - process['stdin']['setEncoding']('utf8'); - } + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // currently, FS.init does not distinguish if process.stdin is a file or TTY + // // device, it always assumes it's a TTY device. because of this, we're forcing + // // process.stdin to UTF8 encoding to at least make stdin reading compatible + // // with text files until FS.init can be refactored. + // process['stdin']['setEncoding']('utf8'); + // } }, shutdown: function() { - if (ENVIRONMENT_IS_NODE) { - // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)? - // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation - // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists? - // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle - // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call - process['stdin']['pause'](); - } + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)? + // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation + // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists? + // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle + // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call + // process['stdin']['pause'](); + // } }, register: function(dev, ops) { TTY.ttys[dev] = { input: [], output: [], ops: ops }; diff --git a/tools/shared.py b/tools/shared.py index 3ee5db23..09526490 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -843,6 +843,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e raise del env['EMMAKEN_JUST_CONFIGURE'] if process.returncode is not 0: + logging.error('Configure step failed with non-zero return code ' + str(process.returncode) + '! Command line: ' + str(args)) raise subprocess.CalledProcessError(cmd=args, returncode=process.returncode) @staticmethod @@ -893,12 +894,13 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e # except: # pass env = Building.get_building_env(native) + log_to_file = os.getenv('EM_BUILD_VERBOSE') == None or int(os.getenv('EM_BUILD_VERBOSE')) == 0 for k, v in env_init.iteritems(): env[k] = v if configure: # Useful in debugging sometimes to comment this out (and the lines below up to and including the |link| call) try: - Building.configure(configure + configure_args, stdout=open(os.path.join(project_dir, 'configure_'), 'w'), - stderr=open(os.path.join(project_dir, 'configure_err'), 'w'), env=env) + Building.configure(configure + configure_args, env=env, stdout=open(os.path.join(project_dir, 'configure_'), 'w') if log_to_file else None, + stderr=open(os.path.join(project_dir, 'configure_err'), 'w') if log_to_file else None) except subprocess.CalledProcessError, e: pass # Ignore exit code != 0 def open_make_out(i, mode='r'): @@ -911,8 +913,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e with open_make_out(i, 'w') as make_out: with open_make_err(i, 'w') as make_err: try: - Building.make(make + make_args, stdout=make_out, - stderr=make_err, env=env) + Building.make(make + make_args, stdout=make_out if log_to_file else None, + stderr=make_err if log_to_file else None, env=env) except subprocess.CalledProcessError, e: pass # Ignore exit code != 0 try: @@ -924,10 +926,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e break except Exception, e: if i > 0: - # Due to the ugly hack above our best guess is to output the first run - with open_make_err(0) as ferr: - for line in ferr: - sys.stderr.write(line) + if log_to_file: + # Due to the ugly hack above our best guess is to output the first run + with open_make_err(0) as ferr: + for line in ferr: + sys.stderr.write(line) raise Exception('could not build library ' + name + ' due to exception ' + str(e)) if old_dir: os.chdir(old_dir) |