Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I try to insert automatic timestamps into a LaTeX file, to get id's for some items On a windows machine I have got the following macro (JavaScript):

    var res=system("c:\\cygwin\\bin\\bash.exe -c '/bin/date +%%s'");
    var timestamp=res.readAllStandardOutputStr();

I can see the correct result (a long number indicating seconds) appear on the messages screen in TeXStudio:

    Prozess gestartet: c:\cygwin\bin\bash.exe -c '/bin/date +%s'
    Prozess endete normal

Nothing spectacular. I tested the exit code, which was OK as well. But it seems not to gather stdout using readAllStandardOutputStr() as I see nothing to appear in my file. editor.write seems to work according to tests I tried. Putting readAllStandardOutputStr() after waitForFinished() didn't help either. Help ot hint appreciated.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Indeed, the standard output is empty. Likely it get's read out internally for the message panel before your call (This would be a bug, or at least a misleading description in the documentation). In your case, you can use this code:

var res=system("texdoc --version");
res.standardOutputRead.connect( function(output) {
share|improve this answer
This answer definitely works, many thanks. – Ulrich Hauser-Ehninger Feb 20 '14 at 10:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.