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.


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) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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