From d6ee383e75ead10de539db063cba5063014bb4af Mon Sep 17 00:00:00 2001 From: Baptist BENOIST Date: Wed, 10 Feb 2016 21:27:26 +0100 Subject: [PATCH 1/3] Add an option to execute additional commands before GDB when using SSH Closes #15 --- src/backend/backend.ts | 1 + src/backend/mi2/mi2.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/backend.ts b/src/backend/backend.ts index 914847c..d4b2e7d 100644 --- a/src/backend/backend.ts +++ b/src/backend/backend.ts @@ -24,6 +24,7 @@ export interface SSHArguments { remotex11screen: number; x11port: number; x11host: string; + bootstrap: string; } export interface IBackend { diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 4a56c67..2cb74e4 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -93,7 +93,9 @@ export class MI2 extends EventEmitter implements IBackend { screen: args.remotex11screen }; } - this.sshConn.exec(this.application + " " + this.preargs.join(" "), execArgs, (err, stream) => { + let sshCMD = this.application + " " + this.preargs.join(" "); + if (args.bootstrap) sshCMD = args.bootstrap + " && " + sshCMD; + this.sshConn.exec(sshCMD, execArgs, (err, stream) => { if (err) { this.log("stderr", "Could not run " + this.application + " over ssh!"); this.log("stderr", err.toString()); From 957f04ea020dc886d06770cdea110794f63bea5e Mon Sep 17 00:00:00 2001 From: Baptist BENOIST Date: Wed, 10 Feb 2016 21:57:13 +0100 Subject: [PATCH 2/3] Document the ssh.bootstrap configuration option --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fdfbd2..852ac20 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,9 @@ request. "password": "password123", "user": "remoteUser", "x11host": "localhost", - "x11port": 6000 + "x11port": 6000, + // Optional, content will be executed on the SSH host before the debugger call. + "bootstrap": "source /home/remoteUser/some-env" } ``` @@ -95,4 +97,8 @@ For X11 forwarding to work you first need to enable it in your Display Manager a connections. To allow connections you can either add an entry for applications or run `xhost +` in the console while you are debugging and turn it off again when you are done using `xhost -`. +Because some builds requires one or more environment files to be sourced before running any +command, you can use the `ssh.bootstrap` option to add some extra commands which will be prepended +to the debugger call (using `&&` to join both). + ## [Issues](https://github.com/WebFreak001/code-debug) \ No newline at end of file From 282ef1f4c435e5e4304ac186eea639ded7f81dce Mon Sep 17 00:00:00 2001 From: Baptist BENOIST Date: Wed, 10 Feb 2016 22:00:38 +0100 Subject: [PATCH 3/3] Add missing ssh.bootstrap option description in package.json --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index cecb08d..f8da48e 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,10 @@ "type": "number", "description": "Screen to start the application on the remote side", "default": 0 + }, + "bootstrap": { + "type": "string", + "description": "Content will be executed on the SSH host before the debugger call." } } }