Skip to content

Commit 83ccd88

Browse files
authored
Merge pull request #182 from Automattic/pltfrm-2043-vip-import-sql-fails-inside-directory-provided-in-app-code
fix: set `workdir` properly
2 parents b464ab6 + 5f0ff44 commit 83ccd88

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

plugins/lando-tooling/lib/utils.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,6 @@ const _ = require('lodash');
66
const escape = require('./../../../lib/utils').shellEscape;
77
const getUser = require('./../../../lib/utils').getUser;
88
const getCliEnvironment = require('./../../../lib/utils').getCliEnvironment;
9-
const path = require('path');
10-
11-
/*
12-
* Helper to map the cwd on the host to the one in the container
13-
*/
14-
const getContainerPath = appRoot => {
15-
// Break up our app root and cwd so we can get a diff
16-
const cwd = process.cwd().split(path.sep);
17-
const dir = _.drop(cwd, appRoot.split(path.sep).length);
18-
// Add our in-container app root
19-
// this will always be /app
20-
dir.unshift('/app');
21-
// Return the directory
22-
return dir.join('/');
23-
};
249

2510
/*
2611
* Build docker exec opts
@@ -117,7 +102,7 @@ exports.buildCommand = (app, command, service, user, env = {}, dir = undefined)
117102
opts: {
118103
environment: getCliEnvironment(env),
119104
mode: 'attach',
120-
workdir: dir || getContainerPath(app.root),
105+
workdir: dir || '/app',
121106
user: (user === null) ? getUser(service, app.info) : user,
122107
services: _.compact([service]),
123108
hijack: false,

0 commit comments

Comments
 (0)