Hi Pauolo,

sorry for the next dumb question (but I'm actually quite good at it)

* what is the result of the failed "bibtex" invocation?

* is "bibtex" a native binary or a shell script?

* depending on the error - can you replace the "bibtex" with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set

Cheers,

Siegfried Goeschl

On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote:
Hello Siegfried!

Wow, thanks for the fast response. :)

Deeply sorry, I forgot to mention the environment. I'm running my code
under Linux (Fedora 20, Java 1.7.0) and MacOSX (Mavericks, 10.9.2). I
was unaware of the .aux thing under Windows, it's good to know about it;
TeX tools use .aux files all the time, so it might be interesting to
investigate some side effects from it. :)

Apparently, the error persists with other tool named makeglossaries that
also uses this .aux file. I'm starting to get scared. :)

All the best,

Paulo

Em 24-04-2014 09:50, Siegfried Goeschl escreveu:
Hi Paulo,

some stupid thought and it might not even be related to your problem

"aux" is under Windows a reserved and can't be used as file name - see
http://en.wikipedia.org/wiki/Filename - are you running the stuff under
WIndows?

Is it possible to rename the offending file to something different then
".aux"

Cheers,

Siegfried Goeschl

On 24.04.14 14:36, Paulo Roberto Massa Cereda wrote:
Dear friends,

For some time, I was sure issue #54
(https://issues.apache.org/jira/browse/EXEC-54) was the culprit of one
my programs misbehaving. Today, I decided to devote some time in
understanding what's been happening in my code and apparently issue
#54 does not appear to be culprit here!

Here's a sample code that might explain what's happening. Note that I
use two programs here (pdflatex and bibtex, hopefully available from
any recent TeX distribution), and similar expansions lead to different
results. Apologies for the long code excerpt.

===============================================================
@Test
    public void testCommonsExecExecution() throws IOException,
InterruptedException {
        String program = "bibtex";
        String argument = "file with spaces.aux";
        CommandLine line = new CommandLine(program);
        line.addArgument(argument);

        // so far, everything ok
        assertEquals(line.toString(), "[bibtex, \"file with
spaces.aux\"]");

        DefaultExecuteResultHandler resultHandler = new
DefaultExecuteResultHandler();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        PumpStreamHandler streamHandler = new PumpStreamHandler(out,
out);

        DefaultExecutor executor = new DefaultExecutor();
        executor.setStreamHandler(streamHandler);
        executor.execute(line, resultHandler);
        resultHandler.waitFor();

        // bibtex is executed with "file with spaces.aux".aux,
        // which is not what I expected
        assertEquals(out.toString(), "I couldn't open file name
`\"file with spaces.aux\".aux'\n");

        program = "pdflatex";
        argument = "file with spaces.tex";

        line = new CommandLine(program);
        line.addArgument(argument);

        // so far, everything ok
        assertEquals(line.toString(), "[pdflatex, \"file with
spaces.tex\"]");

        resultHandler = new DefaultExecuteResultHandler();
        out = new ByteArrayOutputStream();
        streamHandler = new PumpStreamHandler(out, out);

        executor = new DefaultExecutor();
        executor.setStreamHandler(streamHandler);
        executor.execute(line, resultHandler);
        resultHandler.waitFor();

        // here, pdflatex works with "file with spaces.tex"
        assertTrue(out.toString().contains("! I can't find file
`\"file with spaces.tex\"'."));

    }
===============================================================

Note that Exec has both

[ bibtex, file with spaces.aux ]
[ pdflatex, file with spaces.tex ]

parsed correctly, but only the latter execution is properly done. Now
I'm not sure if it's even Exec's fault, but what strikes me is the
fact that with pdflatex, the execution works.

Maybe I'm missing something obvious. Could you guys shed some light
into this problem?

All the best,

Paulo

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to