From d9e78e4fa887ae75e1763730b32b4f40d9250631 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 3 Mar 2016 21:56:39 -0800 Subject: [PATCH] build(analytics): allow build analytics to take previous exit code as the first argument --- tools/analytics/build-analytics | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/analytics/build-analytics b/tools/analytics/build-analytics index 65f755cede..4271c8af29 100755 --- a/tools/analytics/build-analytics +++ b/tools/analytics/build-analytics @@ -1,5 +1,10 @@ #!/usr/bin/env node +// Usage: +// +// build analytics start|success|error| + + 'use strict'; @@ -16,6 +21,11 @@ if (!analytics[actionCategory + 'Start']) { throw new Error('Unknown build-analytics actionCategory "' + actionCategory + '"'); } +var exitCode = Number.parseInt(eventType, 10); +if (!Number.isNaN(exitCode)) { + eventType = (exitCode === 0) ? 'success' : 'error'; +} + if (eventType != 'start' && eventType != 'success' && eventType != 'error') { throw new Error('Unknown build-analytics eventType "' + eventType + '"'); }