You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Carlos Santana (JIRA)" <ji...@apache.org> on 2013/10/23 20:15:44 UTC

[jira] [Comment Edited] (CB-5187) cordova-cli on windows broken for compile, emulate, run

    [ https://issues.apache.org/jira/browse/CB-5187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13803065#comment-13803065 ] 

Carlos Santana edited comment on CB-5187 at 10/23/13 6:15 PM:
--------------------------------------------------------------

[~shepheb] you are correct.
There are two ways to fix this:

detect windows (os.platform), do you have a reference with proper way of doing this?

1. append ".bat" to cmd
{code}
 script = iswindows ? 'build.bat' : 'build'
 cmd = path.join(projectRoot, 'platforms', platform, 'cordova', script)
{code}

2. use "cmd /c"
{code}
cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'build')
args = ['/c',cmd].concat(args);
cmd = 'cmd';
child_process.spawn(cmd, args);
{code}

I like #2 since the platform can name the script 'build.exe', or 'build.cmd' or 'build.bat' on windows


was (Author: csantana):
[~shepheb] you are correct.
There are two ways to fix this:

detect windows (os.platform), do you have a reference with proper way of doing this?

1. append ".bat" to cmd
{code}
 script = iswindows ? 'build.bat' : 'build'
 cmd = path.join(projectRoot, 'platforms', platform, 'cordova', script)
{code}

2. use "cmd /c"
{code}
cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'build')
args = ['/c',cmd].concat(args);
cmd = 'cmd';
child_process.spawn(cmd, args);
{code}

I like #2 since the platform can name the script 'build', or 'build.cmd' or 'build.bat' 

> cordova-cli on windows broken for compile, emulate, run
> -------------------------------------------------------
>
>                 Key: CB-5187
>                 URL: https://issues.apache.org/jira/browse/CB-5187
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: Master
>            Reporter: Carlos Santana
>
> When running cordova-cli on windows is not taking the ".bat" in the scripts
> Steps to reproduce:
> On Windows run
> C:\Users\Carlos\Desktop> node Z:\Documents\cordova\cordova-cli\bin\cordova create C:\Users\Carlos\Desktop\clispawn -d
> Creating a new cordova project with name "HelloCordova" and id "io.cordova.hellocordova" at location "C:\Users\Carlos\Desktop\clispawn"
> Using stock cordova hello-world application.
> cordova library for "www" already exists. No need to download. Continuing.
> Copying stock Cordova www assets into "C:\Users\Carlos\Desktop\clispawn\www"
> C:\Users\Carlos\Desktop> cd .\clispawn
> C:\Users\Carlos\Desktop\clispawn> node Z:\Documents\cordova\cordova-cli\bin\cordova platform add wp8
> Downloading cordova library for wp8...
> Download complete
> Checking wp8 requirements...
> Creating wp8 project...
> Preparing wp8 project
> C:\Users\Carlos\Desktop\clispawn> node Z:\Documents\cordova\cordova-cli\bin\cordova build -d
> cordova library for "wp8" already exists. No need to download. Continuing.
> Generating config.xml from defaults for platform "wp8"
> Calling plugman.prepare for platform "wp8"
> Preparing wp8 project
> Processing configuration changes for plugins.
> Iterating over installed plugins: []
> Writing out cordova_plugins.js...
> Compiling app on platform "wp8" via command "C:\Users\Carlos\Desktop\clispawn\platforms\wp8\cordova\build"
> Error: spawn ENOENT
>     at errnoException (child_process.js:980:11)
>     at Process.ChildProcess._handle.onexit (child_process.js:771:34)



--
This message was sent by Atlassian JIRA
(v6.1#6144)