[pve-devel] [PATCH v3 xterm 1/1] xterm: added new parameter to pass a command to the newly opened terminal

Tim Marx t.marx at proxmox.com
Tue Jan 22 12:21:59 CET 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 src/www/main.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/www/main.js b/src/www/main.js
index 26213a3..6a1dba3 100644
--- a/src/www/main.js
+++ b/src/www/main.js
@@ -23,6 +23,7 @@ var type = getQueryParameter('console');
 var vmid = getQueryParameter('vmid');
 var vmname = getQueryParameter('vmname');
 var nodename = getQueryParameter('node');
+var cmd = getQueryParameter('cmd');
 
 function updateState(newState, msg) {
     var timeout, severity, message;
@@ -111,6 +112,9 @@ function createTerminal() {
 	case 'upgrade':
 	    params.upgrade = 1;
 	    break;
+	case 'cmd':
+	    params.cmd = decodeURI(cmd);
+	    break;
     }
     API2Request({
 	method: 'POST',
@@ -273,7 +277,7 @@ function checkMigration() {
 function tryReconnect() {
     var time_since_started = new Date() - starttime;
     var type = getQueryParameter('console');
-    if (time_since_started < 5*1000 || type === 'shell') { // 5 seconds
+    if (time_since_started < 5*1000 || type === 'shell' || type === 'cmd') { // 5 seconds
 	stopTerminal();
 	return;
     }
-- 
2.11.0




More information about the pve-devel mailing list