From 9d69951faaa0a88f416b6900436a3fd6fce094c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 5 Aug 2014 12:33:08 +0200 Subject: [PATCH 1/2] Fixed double file request after file upload causing autoscrolling to uploaded file to not work --- src/octoprint/static/js/app/viewmodels/files.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index e9bc301f..aa838a21 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -106,13 +106,18 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel) { self.isSdReady(data.flags.sdReady); }; + self._otherRequestInProgress = false; self.requestData = function(filenameToFocus, locationToFocus) { + if (self._otherRequestInProgress) return; + + self._otherRequestInProgress = true; $.ajax({ url: API_BASEURL + "files", method: "GET", dataType: "json", success: function(response) { self.fromResponse(response, filenameToFocus, locationToFocus); + self._otherRequestInProgress = false; } }); }; From d4e7c2e1b15eab0f282b4e738a4446244d5a9585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 5 Aug 2014 19:03:04 +0200 Subject: [PATCH 2/2] We actually do want to run the configured system commands on the shell, so set shell to True Also includes a workaround for sarge bug no. 21 Closes #489 --- src/octoprint/server/api/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 2af44726..530970dc 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -161,7 +161,12 @@ def performSystemAction(): if availableAction["action"] == action: logger.info("Performing command: %s" % availableAction["command"]) try: - p = sarge.run(availableAction["command"], stderr=sarge.Capture()) + # Note: we put the command in brackets since sarge (up to the most recently released version) has + # a bug concerning shell=True commands. Once sarge 0.1.4 we can upgrade to that and remove this + # workaround again + # + # See https://bitbucket.org/vinay.sajip/sarge/issue/21/behavior-is-not-like-popen-using-shell + p = sarge.run([availableAction["command"]], stderr=sarge.Capture(), shell=True) if p.returncode != 0: returncode = p.returncode stderr_text = p.stderr.text