From 09d1c36791a4abd7128dfe5b790dd2b90d7c79b2 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 21 Mar 2011 20:30:46 +0000 Subject: [PATCH] only use deferred open for integration pipe on OS X, since it doesn't seem to work on Linux --- chrome/content/zotero/xpcom/integration.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index b77a40099..706104366 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -41,6 +41,7 @@ Zotero.Integration = new function() { var _osascriptFile; var _inProgress = false; var _integrationVersionsOK = null; + var _useDeferredOpenForIntegrationPipe = false; var _winUser32; this.sessions = {}; @@ -255,7 +256,7 @@ Zotero.Integration = new function() { * Initializes the nsIInputStream and nsIInputStreamPump to read from _fifoFile */ function _initializePipeStreamPump() { - if(Zotero.isFx4) { + if(_useDeferredOpenForIntegrationPipe) { // Fx 4 supports deferred open; no need to use sh var fifoStream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); @@ -277,6 +278,8 @@ Zotero.Integration = new function() { * Initializes the Zotero Integration Pipe */ function _initializeIntegrationPipe() { + _useDeferredOpenForIntegrationPipe = Zotero.isMac && Zotero.isFx4; + // make a new pipe var mkfifo = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); @@ -297,7 +300,7 @@ Zotero.Integration = new function() { proc.run(true, [_fifoFile.path], 1); if(_fifoFile.exists()) { - if(Zotero.isFx36) { + if(!_useDeferredOpenForIntegrationPipe) { // no deferred open capability, so we need to use the sh/tmpfile hack // make a tmp file @@ -438,7 +441,7 @@ Zotero.Integration = new function() { oStream.write(cmd, cmd.length); oStream.close(); _fifoFile.remove(false); - if(Zotero.isFx36) _tmpFile.remove(false); + if(!__useDeferredOpenForIntegrationPipe) _tmpFile.remove(false); } /**