You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by al...@apache.org on 2022/05/25 04:55:57 UTC

[openwhisk-wskdebug] branch master updated: fix: nodejs mounted action runner should set the right current working directory

This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git


The following commit(s) were added to refs/heads/master by this push:
     new 5103153  fix: nodejs mounted action runner should set the right current working directory
5103153 is described below

commit 5103153c70e06acea9709ba7587a16c241c34235
Author: Shazron Abdullah <sh...@adobe.com>
AuthorDate: Mon Feb 1 15:48:50 2021 +0800

    fix: nodejs mounted action runner should set the right current working directory
    
    closes #79
---
 src/kinds/nodejs/mount-plain.js   | 3 +++
 src/kinds/nodejs/mount-require.js | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/kinds/nodejs/mount-plain.js b/src/kinds/nodejs/mount-plain.js
index 9298bf0..52eff03 100644
--- a/src/kinds/nodejs/mount-plain.js
+++ b/src/kinds/nodejs/mount-plain.js
@@ -18,6 +18,7 @@
 /* eslint-disable strict */
 
 const fs = require('fs');
+const nodePath = require('path');
 
 // Variables will be replaced before the code is loaded
 
@@ -43,6 +44,8 @@ function load(path) {
 
 // eslint-disable-next-line no-unused-vars
 function main(args) { // lgtm [js/unused-local-variable]
+    process.chdir(nodePath.dirname(path));
+
     // load code again on every new invocation
     const actionMain = load(path);
 
diff --git a/src/kinds/nodejs/mount-require.js b/src/kinds/nodejs/mount-require.js
index 6c4cbbe..273e82f 100644
--- a/src/kinds/nodejs/mount-require.js
+++ b/src/kinds/nodejs/mount-require.js
@@ -17,6 +17,8 @@
 
 /* eslint-disable strict */
 
+const nodePath = require('path');
+
 // Variables will be replaced before the code is loaded
 
 // path to actual action sources
@@ -36,6 +38,7 @@ let firstRun = true;
 
 // eslint-disable-next-line no-unused-vars
 function main(args) { // lgtm [js/unused-local-variable]
+    process.chdir(nodePath.dirname(path));
 
     if (firstRun) {
         const start = Date.now();