[QBS] How to redirect Command output into file

Andrii Anpilogov anpilog at gmail.com
Mon Jul 20 04:00:41 CEST 2015


Yup. I tried to use TextFile and got next error:
:-1: warning: Error when calling output filter function: ReferenceError:
Can't find variable: TextFile


import qbs.TextFile

....

    Rule {

        id: sym

        inputs: ["application"]


        Artifact {

            fileTags: ["sym"]

            filePath: input.fileName.replace(".elf", ".sym")

        }


        prepare: {

            var CmdPath = "arm-none-eabi-nm";

            var args = ["-n", input.filePath];

            var cmd = new Command(CmdPath, args);

            cmd.stdoutFilterFunction = function ()

            {


                file = new TextFile(output.filePath, TextFile.WriteOnly);

                file.truncate();


                file.write('Some output\n');


                file.close();

            }


            cmd.description = "Generating Symbol file: " + input.fileName;

            cmd.highlight = "linker";

            return cmd;

        }

    }


2015-07-17 20:14 GMT+08:00 Christian Kandeler <
christian.kandeler at theqtcompany.com>:

> On 07/17/2015 01:43 PM, Andrii Anpilogov wrote:
> > I could not find a way to generate symbol file with QBS and GCC.
>
> See http://doc.qt.io/qbs/jsextension-textfile.html
>
>
> Christian
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>



-- 
-- 
WBR,
  Andrii Anpilogov
  Phone: +86 186-1660-3720
  Skype: anpilogov.andrey
  mailto:anpilog at gmail.com, andrii.anpilogov at mesheven.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150720/ed520b61/attachment.html>


More information about the Qbs mailing list