Skip to content

Commit 3835679

Browse files
committed
Add better puppet-agent detection
Previously the default behaviour was to use ruby in the path however some puppet agent installations do not put its ruby on the path and is instead located in /opt/puppetlabs/puppet/bin/ruby. This commit adds file detection to prefer the specific puppet agent location of ruby and fall back to just the path.
1 parent 0fb3e6f commit 3835679

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/src/connection.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ export class ConnectionManager implements IConnectionManager {
209209
break;
210210
default:
211211
myOutputChannel.appendLine('Starting language server')
212-
cmd = 'ruby'
212+
213+
// Try and find the puppet-agent ruby
214+
let rubyPath: string = '/opt/puppetlabs/puppet/bin/ruby';
215+
if (fs.existsSync(rubyPath)) { cmd = rubyPath }
216+
217+
// Default to ruby on the path
218+
if (cmd == undefined) { cmd = 'ruby' }
213219
options = {
214220
shell: true,
215221
env: process.env,

0 commit comments

Comments
 (0)