[Pkg-mozext-commits] [itsalltext] 387/459: Added error message when editor fails to start
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit a32cce4a8f9c565839b625023863c97fd7d47094
Author: Christian Höltje <docwhat at gerf.org>
Date: Fri Aug 26 08:08:44 2011 -0400
Added error message when editor fails to start
A dialog pops up showing the command and the exit code.
This change requires Firefox 3.6 or newer.
---
src/chrome/content/cacheobj.js | 33 ++++++++++++++++++++++++++-------
src/install.rdf | 2 +-
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index 0f45045..62af239 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -348,6 +348,7 @@ CacheObj.prototype.edit = function (extension, clobber) {
var filename = this.write(clobber),
program = null,
+ command,
process,
args,
result,
@@ -377,26 +378,44 @@ CacheObj.prototype.edit = function (extension, clobber) {
// OS-X .app bundles should be run with open.
args = ['-a', program.path, filename];
program = itsalltext.factoryFile('/usr/bin/open');
+ command = ['/usr/bin/open', '-a', program.path, filename];
} else {
/* Mac check because of
* https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
if (!(itsalltext.isDarwin() || program.isExecutable())) {
throw {name: "NS_ERROR_FILE_ACCESS_DENIED"};
}
- args = [filename];
+ args = [program.path, filename];
+ command = [program.path, filename];
}
+ // Create an observer.
+ var observer = {
+ observe: function (subject, topic, data) {
+ // Topic moved as last argument to callbacks since we don't need it (we already know what it is)
+ if (topic==='process-finished') {
+ if (subject.exitValue != 0) {
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ prompts.alert(null, "Editor exited with status of " + subject.exitValue,
+ "I ran this command: " + (command.join(' ')) + "\n\n...and it exited with a status of " + subject.exitValue + ".");
+ }
+ itsalltext.debug("Process exited successfully: ", subject, data);
+ }
+ else if (topic === 'process-failed') {
+ itsalltext.debug("Process exited unsuccessfully: ", subject, data);
+ } else {
+ itsalltext.debug("Observer had a hard time: ", subject, topic, data);
+ }
+ }
+ };
+
// create an nsIProcess
process = procutil.createInstance(Components.interfaces.nsIProcess);
process.init(program);
// Run the process.
- // If first param is true, calling thread will be blocked until
- // called process terminates.
- // Second and third params are used to pass command-line arguments
- // to the process.
- result = {};
- ec = process.run(false, args, args.length, result);
+ process.runwAsync(args, args.length, observer, false);
this.private_is_watching = true;
this.edit_count++;
diff --git a/src/install.rdf b/src/install.rdf
index 911175e..c607a9c 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -6,7 +6,7 @@
<!-- Firefox -->
<RDF:Description RDF:about="rdf:#$firefox"
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
- em:minVersion="3.5"
+ em:minVersion="3.6"
em:maxVersion="8.0a1" />
<!-- SeaMonkey -->
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list