Simon and others,
I'm getting closer to getting this to work on the Mac, or at least
understanding what's going on. Below is the code that I changed for
the execute() method on the task. The problem with using "open" is
that its process doesn't continue while the SWF is running. It opens
the Flash player and figures it's done with the process at that point.
So this obviously won't work. Any other ideas out there, besides "get
a Windows machine"?
public void execute() throws BuildException {
if (swf == null) {
throw new BuildException("A unit test swf must be
supplied.", getLocation());
}
if (flashPlayer == null) {
throw new BuildException("A flash player must be
supplied.", getLocation());
}
Commandline command = new Commandline();
if (System.getProperty("os.name").equals("Mac OS X")) {
command.setExecutable("open");
command.createArgument().setValue(flashPlayer.getPath());
} else {
//for windows
command.setExecutable(flashPlayer.getPath());
}
command.createArgument().setFile(swf);
Receiver receiver = new Receiver(this);
receiver.startServer(port);
try {
log(command.toString());
Process process = Execute.launch(getProject(),
command.getCommandline(), null, getProject().getBaseDir(), true);
receiver.setProcess(process);
process.waitFor();
}
catch (IOException e) {
throw new BuildException("Error running unit tests.",
e, getLocation());
}
catch (InterruptedException e) {
throw new BuildException("Error running unit tests.",
e, getLocation());
}
receiver.stopServer();
}
On 6/13/06, Chris Allen <[EMAIL PROTECTED]> wrote:
> Okay,
>
> This is the reason it fails:
> http://www.osflash.org/pipermail/osflash_osflash.org/2006-March/007968.html
>
> Thanks to Erixtekila for the answer that he wrote to the list a while ago.
>
> Simon, I will look into creating a version that will work with the
> Mac. I will let you know how it goes.
>
> -Chris
>
> On 6/13/06, Chris Allen <[EMAIL PROTECTED]> wrote:
> > On 6/13/06, Simon Wacker <[EMAIL PROTECTED]> wrote:
> > > This exception is thrown when the unit test swf is closed before the
> > > <finish> data has been sent and thus before the socket has been closed.
> > > In your case no data is sent at all.
> > >
> > > Are you seeing the swf being opened and closed? Or are your closing it
> > > yourself?
> > >
> > > Another issue may be that the swf execution process is closed although
> > > the swf is open (but it should be open as long as the swf).
> > >
> >
> > Well these are really great hints as to what is happening. The SWF
> > never actually opens in the FlashPlayer. I think I have an idea as to
> > why this is happening. Mac OSX uses application bundles for the
> > applications that you double click on to open. In order to execute
> > them from the command line you need to dig into the bundle and target
> > the "actual" application in there.
> >
> > I will try and play around with this approach and let you know how it goes.
> >
> > -Chris
> >
>
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org