[gnome-ostree] make: Tail output of task by default
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] make: Tail output of task by default
- Date: Thu, 21 Feb 2013 17:48:12 +0000 (UTC)
commit c1fed11c64e89d551a357f7fb2c1384e31f92f53
Author: Colin Walters <walters verbum org>
Date: Thu Feb 21 08:55:49 2013 -0500
make: Tail output of task by default
Just nicer.
src/ostbuild/js/builtins/make.js | 11 +++++++++++
src/ostbuild/js/task.js | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/ostbuild/js/builtins/make.js b/src/ostbuild/js/builtins/make.js
index 9ee9901..93dcfae 100644
--- a/src/ostbuild/js/builtins/make.js
+++ b/src/ostbuild/js/builtins/make.js
@@ -51,6 +51,7 @@ const Make = new Lang.Class({
let taskmaster = new Task.TaskMaster(this.workdir.get_child('tasks'),
{ onEmpty: Lang.bind(this, this._onTasksComplete) });
this._taskmaster = taskmaster;
+ taskmaster.connect('task-executing', Lang.bind(this, this._onTaskExecuting));
taskmaster.connect('task-complete', Lang.bind(this, this._onTaskCompleted));
let params = {};
for (let i = 0; i < args.parameters.length; i++) {
@@ -69,7 +70,17 @@ const Make = new Lang.Class({
print("Success!")
},
+ _onTaskExecuting: function(taskmaster, task) {
+ let workdir = task._workdir;
+ print("Task " + task.name + " executing in " + workdir.get_path());
+ let output = workdir.get_child('output.txt');
+ let context = new GSystem.SubprocessContext({ argv: ['tail', '-f', output.get_path() ] });
+ this._tail = new GSystem.Subprocess({ context: context });
+ this._tail.init(null);
+ },
+
_onTaskCompleted: function(taskmaster, task, success, error) {
+ this._tail.request_exit();
if (success) {
print("Task " + task.name + " complete: " + task._workdir.get_path());
} else {
diff --git a/src/ostbuild/js/task.js b/src/ostbuild/js/task.js
index 3c81431..757e139 100644
--- a/src/ostbuild/js/task.js
+++ b/src/ostbuild/js/task.js
@@ -183,7 +183,7 @@ const TaskMaster = new Lang.Class({
!this.isTaskExecuting(this._pendingTasksList[0].name)) {
let task = this._pendingTasksList.shift();
task._executeInSubprocessInternal(this.cancellable);
- print("Task " + task.name + " running in " + task._workdir.get_path());
+ this.emit('task-executing', task);
this._executing.push(task);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]