The docs for fabric are here: http://docs.fabfile.org/en/1.10/

I don't think that fabric8.io is in any way affiliated.

I don't know what you mean by "Doesn't work", can you elaborate?

On Wed, Nov 25, 2015 at 8:38 AM Tameem Ahmed <[email protected]> wrote:

> Hi,
>
> I have this simple fab script and I want to execute from a java program.
>
>  from __future__ import with_statement
>     from fabric.api import *
>     from fabric.contrib.console import confirm
>     env.hosts = ['localhost']
>
>     def updatefile():
>      with shell_env(TERM='vt100'):
>     with cd('/Users/'):
>     run("pwd")
>     run("ls -l")
>
>     def execute():
>       updatefile()
>
>
> When I execute this script from command line it works : fab -f test.py 
> executes but I want to execute via java. Tried with ..
>
> public class ExecuteScript {
> @Testpublic void testExecuteScript() throws NumberFormatException, 
> IOException{
>
>     StringBuffer output = new StringBuffer();
>     Process p;
>     try {
>         p = Runtime.getRuntime().exec("fab -f 
> src/test/resources/scripts/test.py execute");
>         p.waitFor();
>         BufferedReader reader =
>                 new BufferedReader(new InputStreamReader(p.getInputStream()));
>
>         String line = "";
>         while ((line = reader.readLine())!= null) {
>             output.append(line + "\n");
>         }
>
>     } catch (Exception e) {
>         e.printStackTrace();
>     }
>     System.out.println(output.toString());}}
>
> It doesn't work.. looked at the documentation for java examples 
> inhttp://fabric8.io/gitbook/quickstarts.html the links are broken.
>
>
> Thanks,
>
> Tameem
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user
>
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to