Island Process

Hi,
I want to run a process from within a console app on Linux. Is this correct ?

  var aArguments := new ImmutableList<String>(['-H']);

  var p := new Process;
  p.Arguments := aArguments;
  p.Command := 'hostname';

  try

    p.Start;
    p.WaitFor;
  except
    on e: Exception do
    begin
      writeLn(e.Message);
    end;
  end;

It got past the waitfor on darwin but I get an exception on linux show inside the debug window of Fire.

!> Fatal exception of type RemObjects.Elements.System.Exception on thread 25E2
!> Message: Array index 1 is outside of the valid range (0..0)

Cheers,
John

HostnameUpdater.zip (3.6 MB)

For one, pretty sure you’ll want/need a full path for Command, as a Process doesn’t go thru the shell, and the shell is what lets you magically find executables via search paths, just by name.

So you;ll want

p.Command := '/bin/hostname'

or wherever Linux has that one. That said, the error sounds wrong, so i’ll have a look…

PS I can repro the “~> Could not determine appropriate architecture.” issue with this one,. will have a look at a better error there too.

Fixed to

~> Could not determine appropriate architecture. Active project architectures are 'armv6', target device architecture is 'x86_64'.

Does this look ok ?

      var aArguments := new ImmutableList<String>([]);

      var p := new Process();
      p.Arguments := aArguments;
      p.Command := '/bin/hostname';
      p.RedirectOutput := true;
      p.Start;
      p.WaitFor;
      
      var aStdOut := p.StandardOutput;
      var aStdErr := p.StandardError;
      

      if(p.ExitCode = 0)then
      begin
        var value := p.StandardOutput;

        writeLn(value);

      end;

With my code on darwin I get a segmentation fault when I add the redirectoutput := true.

IN the debugger it displays the output what Im assuming is the actual hostname command but it seems to hang and never gets to the check on exitcode

If I call the run method directly it looks like it calls prepare twice.

Once from the run method and another time inside start.

I also get this if I open the island solution

Project license file for RemObjects C# for Island expired July 03 2021

Is that the community one ? If so could you extend it ?

I built island and Im trying to debug that.

Shown in the screenshot is inside Start, at this point the debugger seem to have hung. Outside the debugger it crashes with a segmentation fault

Island RTL? will do.

Logged as bugs://E25571.

Yes it was IslandRTL

1 Like

Fixed. looks like two projects didn’t have a guid back when this license was created but do now.

1 Like

bugs://E25571 was closed as fixed.

1 Like

Thanks, this is fixed.

1 Like