From d3c6bd2f98a8a924619124556c7a8c03b4bff02f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 9 Jan 2014 13:47:51 -0800 Subject: [PATCH 1/3] Use close instead of exit stdio might still be open when exit is called (http://nodejs.org/api/child_process.html#child_process_event_exit). With close you are guaranteed that there will be no more output. --- build/tasks/task-helpers.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/task-helpers.coffee b/build/tasks/task-helpers.coffee index 4362393d0..f83430884 100644 --- a/build/tasks/task-helpers.coffee +++ b/build/tasks/task-helpers.coffee @@ -39,7 +39,7 @@ module.exports = (grunt) -> proc = childProcess.spawn(options.cmd, options.args, options.opts) proc.stdout.on 'data', (data) -> stdout.push(data.toString()) proc.stderr.on 'data', (data) -> stderr.push(data.toString()) - proc.on 'exit', (exitCode, signal) -> + proc.on 'close', (exitCode, signal) -> error = new Error(signal) if exitCode != 0 results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode} grunt.log.error results.stderr if exitCode != 0 From a1f8a21c7cf2df9e264b04cdc87fd99476ed8665 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 9 Jan 2014 13:55:45 -0800 Subject: [PATCH 2/3] Output warning/error if diskspace on CI server is getting low. --- build/Gruntfile.coffee | 2 +- build/tasks/output-disk-space.coffee | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 build/tasks/output-disk-space.coffee diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 831f18a15..7833ac0ac 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -210,7 +210,7 @@ module.exports = (grunt) -> grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson']) grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint']) grunt.registerTask('test', ['shell:kill-atom', 'run-specs']) - grunt.registerTask('ci', ['download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build']) + grunt.registerTask('ci', ['output-disk-space', 'download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build']) grunt.registerTask('deploy', ['partial-clean', 'download-atom-shell', 'build', 'codesign']) grunt.registerTask('docs', ['markdown:guides', 'build-docs']) grunt.registerTask('default', ['download-atom-shell', 'build', 'set-development-version', 'install']) diff --git a/build/tasks/output-disk-space.coffee b/build/tasks/output-disk-space.coffee new file mode 100644 index 000000000..9767c7b8d --- /dev/null +++ b/build/tasks/output-disk-space.coffee @@ -0,0 +1,25 @@ +module.exports = (grunt) -> + {spawn} = require('./task-helpers')(grunt) + + grunt.registerTask 'output-disk-space', 'Print diskspace available', -> + return unless process.platform is 'darwin' + + done = @async() + + cmd = 'df' + args = ['-Hl'] + spawn {cmd, args}, (error, result, code) -> + return done(error) if error? + + lines = result.stdout.split("\n") + + for line in lines[1..] + [filesystem, size, used, avail, capacity, extra] = line.split(/\s+/) + capacity = parseInt(capacity) + + if capacity > 90 + grunt.log.error("#{filesystem} is at #{capacity}% capacity!") + else if capacity > 80 + grunt.log.error("#{filesystem} is at #{capacity}% capacity.") + + done() From e435b487508c89e404eb8b41fd6b07bb3f7f3888 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 9 Jan 2014 13:58:24 -0800 Subject: [PATCH 3/3] Display warning if disk space is kind of full --- build/tasks/output-disk-space.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/output-disk-space.coffee b/build/tasks/output-disk-space.coffee index 9767c7b8d..372ead672 100644 --- a/build/tasks/output-disk-space.coffee +++ b/build/tasks/output-disk-space.coffee @@ -20,6 +20,6 @@ module.exports = (grunt) -> if capacity > 90 grunt.log.error("#{filesystem} is at #{capacity}% capacity!") else if capacity > 80 - grunt.log.error("#{filesystem} is at #{capacity}% capacity.") + grunt.log.ok("#{filesystem} is at #{capacity}% capacity.") done()