Re: [Vala] multithreading -> weird behaviour on win(msys) and macOS



Tried this, run perfect on linux, runs "better" on win

                try

                {
                    var mainloop = new MainLoop();
                    SourceFunc quit = ()=>
                    {
                        mainloop.quit ();
                        return Source.REMOVE;
                    };
                    read_piped_commands.begin(spawn_args, quit, projectName);
                    mainloop.run();
                }
                catch (SpawnError e)
                {
                    print ("Error: %s\n", e.message);
                }
            }
        }

        async void read_piped_commands(string[] spawn_args, SourceFunc quit, string projectName)
        {
            var subprocess = new Subprocess.newv(spawn_args, (SubprocessFlags.STDOUT_PIPE|SubprocessFlags.STDERR_MERGE));             var output = new DataInputStream (subprocess.get_stdout_pipe());
            try
            {
                string? line = null;
                do
                {
                    line = yield output.read_line_async ();
                    if (line != null)
                    {
buildTextView.buffer.insert_at_cursor(line+"\n", -1);
                        var mark = buildTextView.buffer.get_insert();
                        buildTextView.scroll_to_mark(mark, 0, true, 1, 1);
                        statusList.AddOutput(projectName, line);
                    }
                }while (line != null);
            }
            catch (Error error)
            {
                print (@"Error: $(error.message)\n");
            }
            quit ();
        }


But on win it looks like the error still goes to terminal and still looks weird :-(

No stderr in "buildTextView.buffer", stdout are ok

..........

C:msys64homeWolfgangProjekte
                            Develop
alaDevelopml_configuration.vala:40:10: warning: unknown escape sequence: '\m'
C:msys64homeWolfgangProjekte
                            Develop
alaDevelopml_configuration.vala:40:10: warning: unknown escape sequence: '\h'
C:msys64homeWolfgangProjekte
                            Develop
alaDevelopml_configuration.vala:40:10: warning: unknown escape sequence: '\W'
C:msys64homeWolfgangProjekte
                            Develop
alaDevelopml_configuration.vala:40:10: warning: unknown escape sequence: '\P'
C:msys64homeWolfgangProjekte
                            Develop
alaDevelopml_configuration.vala:40:10: error: \x used with no following hex digits
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
error: cc exited with status 1



Am 12.03.19 um 23:51 schrieb Wolfgang Mauer:
Thank you very much!!!!


Am 12.03.19 um 23:46 schrieb Al Thomas via vala-list:
  > On Tuesday, 12 March 2019, 22:40:17 GMT, Wolfgang Mauer <wolfgang mauer kabelmail de> wrote:
Are there any sample using "GLib.Subprocess" with async
stdin/stdout/stderr ?
See https://stackoverflow.com/a/54391519
That one splices the output from one command to the input of another. So a bit more than you probablyneed, but a good start.

Al
   _______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list

_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]