From 310b45c29c55cab0c25cb6e027879e51682801e8 Mon Sep 17 00:00:00 2001 From: Alex Siryi Date: Thu, 10 Jan 2019 12:24:47 +0200 Subject: [PATCH] Fixed librarian on linux (issues with ENV) --- ruby/Gemfile.lock | 11 +++++++++++ src/async.ts | 2 +- src/puppet.ts | 17 ++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 1e2d3d2..bb54bd9 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -6,6 +6,7 @@ GEM puppet_forge (~> 2.1) rsync certified (1.0.0) + facter (2.5.1) facter (2.5.1-x86-mingw32) ffi (~> 1.9.5) faraday (0.13.1) @@ -30,6 +31,15 @@ GEM minitar (0.6.1) multi_json (1.13.1) multipart-post (2.0.0) + puppet (6.1.0) + facter (> 2.0.1, < 4) + fast_gettext (~> 1.1.2) + hiera (>= 3.2.1, < 4) + httpclient (~> 2.8) + locale (~> 2.1) + multi_json (~> 1.10) + puppet-resource_api (~> 1.5) + semantic_puppet (~> 1.0) puppet (6.1.0-x86-mingw32) facter (> 2.0.1, < 4) fast_gettext (~> 1.1.2) @@ -73,6 +83,7 @@ GEM yard (0.9.16) PLATFORMS + ruby x86-mingw32 DEPENDENCIES diff --git a/src/async.ts b/src/async.ts index 6934f44..43158e7 100644 --- a/src/async.ts +++ b/src/async.ts @@ -293,7 +293,7 @@ export function execFileReadIn(command: string, cwd: string, env?: any, cb?: Exe { if (error != null) { - reject(stdout); + reject(stderr); } else { diff --git a/src/puppet.ts b/src/puppet.ts index 8679d7e..f29bd02 100644 --- a/src/puppet.ts +++ b/src/puppet.ts @@ -40,7 +40,7 @@ export module puppet return null; } - public static async CallBin(script: string, args: string[], cwd: string, env: any, cb?: async.ExecFileLineCallback): Promise + public static async CallBin(script: string, args: string[], cwd: string, env_: any, cb?: async.ExecFileLineCallback): Promise { const argsTotal = [ Ruby.Path().rubyPath, @@ -52,8 +52,11 @@ export module puppet argsTotal.push(arg); } - env["SSL_CERT_FILE"] = require('app-root-path').resolve("ruby", "cacert.pem"); - env["PATH"] = process.env["PATH"] + path.delimiter + Ruby.Path().path; + const env = Object.assign({}, process.env); + Object.assign(env, env_); + + env["SSL_CERT_FILE"] = require('app-root-path').resolve("ruby/cacert.pem"); + env["PATH"] = Ruby.Path().path + path.delimiter + process.env["PATH"]; try { @@ -856,6 +859,10 @@ export module puppet env["LIBRARIAN_PUPPET_USE_SHORT_CACHE_PATH"] = "true"; env["LIBRARIAN_PUPPET_TMP"] = "C:/"; } + else + { + env["LIBRARIAN_PUPPET_TMP"] = path.join(this._path, ".tmp"); + } await Ruby.CallBin("librarian-puppet", ["install", "--verbose"], this._path, env, (line: string) => { @@ -1339,6 +1346,10 @@ export module puppet env["LIBRARIAN_PUPPET_USE_SHORT_CACHE_PATH"] = "true"; env["LIBRARIAN_PUPPET_TMP"] = "C:/"; } + else + { + env["LIBRARIAN_PUPPET_TMP"] = path.join(this._path, ".tmp"); + } await Ruby.CallBin("librarian-puppet", ["install", "--verbose"], this._path, env, (line: string) => {