From c92a5eaefa92c7a6f1ef7a03c89d7e3d5d5cac18 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:27:05 -0700 Subject: [PATCH 1/7] Abort the build when main npm install script fails Part of #64 --- scripts/install.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install.js b/scripts/install.js index e384e1f7..416c1adf 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -4,7 +4,11 @@ const os = require('os'); const path = require('path'); const spawn = require('child_process').spawn; -spawn(os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', ['rebuild'], { +const p = spawn(os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', ['rebuild'], { cwd: path.join(__dirname, '..'), stdio: 'inherit' }); + +p.on('exit', function (code) { + process.exit(code); +}); From 752aba79e7f0ba73225115785e911e088f8b235a Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:31:18 -0700 Subject: [PATCH 2/7] Try fix macOS build --- binding.gyp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/binding.gyp b/binding.gyp index 1bac6f9a..434172c6 100644 --- a/binding.gyp +++ b/binding.gyp @@ -39,6 +39,18 @@ '-lutil' ] }], + ['OS=="mac"', { + "xcode_settings": { + "OTHER_CPLUSPLUSFLAGS": [ + "-std=c++11", + "-stdlib=libc++" + ], + "OTHER_LDFLAGS": [ + "-stdlib=libc++" + ], + "MACOSX_DEPLOYMENT_TARGET":"10.7" + } + }] ] }] } From 3c8fe6ac1caa9dd9749684c5cb5fba0b16ad06d7 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:31:28 -0700 Subject: [PATCH 3/7] Try fix Linux build --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index a9b22da6..29b0f499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,11 @@ node_js: install: - npm install - npm run tsc +before_install: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq install g++-4.8 ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-4.8 ; fi script: - npm test - npm run tslint From 71260fd257a254e97b8b3262d4bbd7e7e48a69e5 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:39:28 -0700 Subject: [PATCH 4/7] Add test case for mac pts name --- test/unixTerminal.test.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/unixTerminal.test.js b/test/unixTerminal.test.js index 100a2682..ac868b4f 100644 --- a/test/unixTerminal.test.js +++ b/test/unixTerminal.test.js @@ -7,8 +7,16 @@ describe("UnixTerminal", function() { describe("Constructor", function() { it("should set a valid pts name", function() { const term = new UnixTerminal('cmd.exe', [], {}); - // Should match form from https://linux.die.net/man/4/pts - assert.ok(/^\/dev\/pts\/\d+$/.test(term.pty)); + + if (process.platform === 'linux') { + // https://linux.die.net/man/4/pts + assert.ok(/^\/dev\/pts\/\d+$/.test(term.pty)); + } + + if (process.platform === 'darwin') { + // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html + assert.ok(/^\/dev\/tty[p-sP-S][a-z0-9]$/.test(term.pty)); + } }); }); }); From c5949d1f38fa4f76fe0ba31c90672bbe967f4c3e Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:47:25 -0700 Subject: [PATCH 5/7] Add logging to test --- test/unixTerminal.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unixTerminal.test.js b/test/unixTerminal.test.js index ac868b4f..7636868d 100644 --- a/test/unixTerminal.test.js +++ b/test/unixTerminal.test.js @@ -7,16 +7,16 @@ describe("UnixTerminal", function() { describe("Constructor", function() { it("should set a valid pts name", function() { const term = new UnixTerminal('cmd.exe', [], {}); - + let regExp; if (process.platform === 'linux') { // https://linux.die.net/man/4/pts - assert.ok(/^\/dev\/pts\/\d+$/.test(term.pty)); + regExp = /^\/dev\/pts\/\d+$/; } - if (process.platform === 'darwin') { // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html - assert.ok(/^\/dev\/tty[p-sP-S][a-z0-9]$/.test(term.pty)); + regExp = /^\/dev\/tty[p-sP-S][a-z0-9]$/; } + assert.ok(regExp.test(term.pty), '"' + term.pty + '" should match ' + regExp.toString()); }); }); }); From bc35cdb6e1947530d530d095995538baea995135 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:51:07 -0700 Subject: [PATCH 6/7] Gate test check behind null check Don't fail tests on sunos/freebsd --- test/unixTerminal.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unixTerminal.test.js b/test/unixTerminal.test.js index 7636868d..e9f5c87c 100644 --- a/test/unixTerminal.test.js +++ b/test/unixTerminal.test.js @@ -16,7 +16,9 @@ describe("UnixTerminal", function() { // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html regExp = /^\/dev\/tty[p-sP-S][a-z0-9]$/; } - assert.ok(regExp.test(term.pty), '"' + term.pty + '" should match ' + regExp.toString()); + if (regExp) { + assert.ok(regExp.test(term.pty), '"' + term.pty + '" should match ' + regExp.toString()); + } }); }); }); From 094f1c48c7aab7c7fe5c34d5eb766d0f2e3b0ecd Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 29 Mar 2017 21:52:27 -0700 Subject: [PATCH 7/7] Tweak condition --- test/unixTerminal.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unixTerminal.test.js b/test/unixTerminal.test.js index e9f5c87c..148a5d28 100644 --- a/test/unixTerminal.test.js +++ b/test/unixTerminal.test.js @@ -14,7 +14,7 @@ describe("UnixTerminal", function() { } if (process.platform === 'darwin') { // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html - regExp = /^\/dev\/tty[p-sP-S][a-z0-9]$/; + regExp = /^\/dev\/tty[p-sP-S][a-z0-9]+$/; } if (regExp) { assert.ok(regExp.test(term.pty), '"' + term.pty + '" should match ' + regExp.toString());