[ https://issues.apache.org/jira/browse/CB-5091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13810587#comment-13810587 ]
ASF subversion and git services commented on CB-5091: ----------------------------------------------------- Commit ab36ffac6e8a77c767244094802dd08b74594163 in branch refs/heads/master from [~shepheb] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;h=ab36ffa ] CB-5091: Use cwd option rather than shell.cd when cloning plugin repos > Installing a plugin using a relative path may fail > -------------------------------------------------- > > Key: CB-5091 > URL: https://issues.apache.org/jira/browse/CB-5091 > Project: Apache Cordova > Issue Type: Bug > Components: Plugman > Reporter: Marcus Pridham > > If I use a relative path to install a local plugin with remote and local > dependencies it may fail dependent on the order of the dependencies. > My plugin has a "local" dependency and a remote dependency. The remote is > <dependency id="org.apache.cordova.dialogs" > url="https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git" /> > > and the local is <dependency id="com.blah.plugin2" subdir="plugins/plugin2" > url="."/> > You can use this repository to reproduce the issue: > https://github.com/marcuspridham/cordova-dependency-issue > Steps: > 1. Install cordova cli version 3.1.0-0.1.0 > 2. Clone https://github.com/marcuspridham/cordova-dependency-issue > 3. Create a project and add a platform with the cordova cli > 4. From your cli project try add plugin1 using a relative patch. eg. cordova > plugin add ../plugin-relative-issue/plugins/plugin1 > Notice the error: cd: no such file or directory: > ../cordova-dependency-issue/plugins/plugin1 > Also the command cordova plugins returns only [ 'com.blah.plugin1', > 'org.apache.cordova.dialogs' ] and not com.blah.plugin2. > Problem: > When the remote dependency is installed plugman changes the working directory > so it can run git clone but it does not change it back. > After the remote plugin is installed, the local plugin is installed and > plugman will try change the directory to > ../cordova-dependency-issue/plugins/plugin1 > but the working directory is now something like > /private/var/folders/pl/v5hfl0zn1tn6z9j15l4j0dp8tgcp1t/T. > Possible Fix: > In https://github.com/apache/cordova-plugman/blob/master/src/util/plugins.js: > Around line 43 remove this: > {code} > shell.cd(path.dirname(tmp_dir)); > {code} > Around line 47 change this: > {code} > child_process.exec(cmd, function(err, stdout, stderr) { > {code} > To: > {code} > child_process.exec(cmd, { cwd: tmp_dir }, function(err, stdout, stderr) { > {code} -- This message was sent by Atlassian JIRA (v6.1#6144)