Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-06

TProcess parameters...

14 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco van de Voort
to Mattias Gaertner: On Sun, 22 Jun 2003 00:50:29 +0200 CommandLine:='bash -c "ls…
Show quoted text 16 lines
> > A first shot here. When you issue ls *.rpm from a shell, the * is expanded > > by your shell and it is'nt passed to ls. ls get (in your case) all 1400 > files as argument. > > What you are excuting is something like ls "*.rpm" and that file does not > exist. > > >I've looked at the TProcess code and can't seem to find any problems > >there. CommandToList and MakeCommand both seem to return the expected > >results. I've concluded the problem may be in CreateProcess... but I > >can't seem to run it down. > >Any suggestions would be appreciated! :) CommandLine:='bash -c "ls /mnt/disk/redhat9/release/*.rpm"';

Don't use bash, (even worse is to hardcode the path to be /bin)

BSD systems sometimes don't have bash (they have sh as default Bourne shell already, which is enough to run standard scripts). And if they do, it is somewhere else, not in /bin.

linux.shell() takes care of this IIRC.

Reply by email

Mattias Gaertner
to Tom Lisjac: TProcess has been working great, but I've run into a parameter passing issue that I…
Show quoted text 35 lines
At 16:37 21-6-2003 -0600, Tom Lisjac wrote: >TProcess has been working great, but I've run into a parameter passing >issue that I haven't been able to resolve: > >Setup: >Options:=[poUsePipes,poNoConsole]; >ApplicationName:=''; >CurrentDirectory:=''; > >The following works fine and returns the full directory listing via >standard out: > >CommandLine:='ls /mnt/disk/redhat9/release'; > >The same line fails when an ambiguous file qualifier is added. The ls >command returns a "file not found" in standard error. There are 1400+ >rpm's in the directory. > >CommandLine:='ls /mnt/disk/redhat9/release/*.rpm'; A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell and it is'nt passed to ls. ls get (in your case) all 1400 files as argument. What you are excuting is something like ls "*.rpm" and that file does not exist. >I've looked at the TProcess code and can't seem to find any problems >there. CommandToList and MakeCommand both seem to return the expected >results. I've concluded the problem may be in CreateProcess... but I >can't seem to run it down. >Any suggestions would be appreciated! :)
CommandLine:='bash -c "ls /mnt/disk/redhat9/release/*.rpm"';

Mattias

Reply by email

Tom Lisjac
to Marco van de Voort: One shouldn't do things Linux only if not absolutely needed so. Do like you develop for…
> > linux.shell() takes care of this IIRC.

Yes, I saw it... thanks! TProcess is a little more convenient because it optionally handles I/O redirection with the flip of a switch. This has made it very easy to put gui wrappers on large, text based utilities like rpm and cdrecord with just a few lines of code.

Probably this is for the theseus > project, which is in fact Linux only.

Epik-Builder is being developed on Linux with RH9, but the design is intended for any package format, distribution or architecture. Debian packaging is next... but I've been wondering about how well Lazarus runs under FreeBSD, so perhaps this would be a good time to ask. :)

-Tom

Reply by email

Marc Weustink
to Tom Lisjac: TProcess has been working great, but I've run into a parameter passing issue that I…
Tom Lisjac wrote 18 lines
TProcess has been working great, but I've run into a parameter passing issue that I haven't been able to resolve: Setup: Options:=[poUsePipes,poNoConsole]; ApplicationName:=''; CurrentDirectory:=''; The following works fine and returns the full directory listing via standard out: CommandLine:='ls /mnt/disk/redhat9/release'; The same line fails when an ambiguous file qualifier is added. The ls command returns a "file not found" in standard error. There are 1400+ rpm's in the directory. CommandLine:='ls /mnt/disk/redhat9/release/*.rpm';

A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell and it is'nt passed to ls. ls get (in your case) all 1400 files as argument.

What you are excuting is something like ls "*.rpm" and that file does not exist.

Show quoted text 5 lines
I've looked at the TProcess code and can't seem to find any problems there. CommandToList and MakeCommand both seem to return the expected results. I've concluded the problem may be in CreateProcess... but I can't seem to run it down. Any suggestions would be appreciated! :)

Hope it helped.

Marc

Reply by email

Marco van de Voort
to Mattias Gaertner: On Sun, 22 Jun 2003 01:11:56 +0200 (CEST) You are right. But if he really wanted an…
Show quoted text 12 lines
On Sun, 22 Jun 2003 01:11:56 +0200 (CEST) (Marco van de Voort) wrote: > shell already, which is enough to run standard scripts). And if they do, > it is somewhere else, not in /bin. > > linux.shell() takes care of this IIRC. You are right. But if he really wanted an OS/Distribution independent solution, he would use FindFirst/Next instead of 'ls'. Probably this is for the theseus project, which is in fact Linux only.

One shouldn't do things Linux only if not absolutely needed so. Do like you develop for Unix, and leave the "getting things to run on *BSD" to the BSD porter if it really happens.

Believe me, 90% of the maintenance on the FPC BSD ports is just changing ifdef linux to ifdef Unix, and changing other basic things. (like hardcoded paths, assumptions that are dangerous under Linux too with all those distro's)

P.s. Lazarus runs under NetBSD/x86. It loads awfully slow, but after 45 secs of starting up it is usable and feels "quick" on this P-III 450 with 384M. I ran a project and it started in the debugger but terminated with SIGBUS, which was presented to me by the IDE (so the gdb interaction is ok).
The problem seems to be that libintl and libgmodule weren't auto linked in for some reason, however I must yet confirm this with 100% certainty by doing some more test builds.

The SIGBUS above is probably the same problem for the compiled demo, as described above for lazarus.

Reply by email

Marco van de Voort
to Marc Weustink: A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell…
Show quoted text 36 lines
At 16:37 21-6-2003 -0600, Tom Lisjac wrote: >TProcess has been working great, but I've run into a parameter passing >issue that I haven't been able to resolve: > >Setup: >Options:=[poUsePipes,poNoConsole]; >ApplicationName:=''; >CurrentDirectory:=''; > >The following works fine and returns the full directory listing via >standard out: > >CommandLine:='ls /mnt/disk/redhat9/release'; > >The same line fails when an ambiguous file qualifier is added. The ls >command returns a "file not found" in standard error. There are 1400+ >rpm's in the directory. > >CommandLine:='ls /mnt/disk/redhat9/release/*.rpm'; A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell and it is'nt passed to ls. ls get (in your case) all 1400 files as argument. What you are excuting is something like ls "*.rpm" and that file does not exist. >I've looked at the TProcess code and can't seem to find any problems >there. CommandToList and MakeCommand both seem to return the expected >results. I've concluded the problem may be in CreateProcess... but I >can't seem to run it down. >Any suggestions would be appreciated! :) Hope it helped.

There is a shell() call for this in unit Unix/Linux IIRC.

Reply by email

Tom Lisjac

TProcess has been working great, but I've run into a parameter passing issue that I haven't been able to resolve:

Setup:
Options:=[poUsePipes,poNoConsole];
ApplicationName:='';
CurrentDirectory:='';

The following works fine and returns the full directory listing via standard out:

CommandLine:='ls /mnt/disk/redhat9/release';

The same line fails when an ambiguous file qualifier is added. The ls command returns a "file not found" in standard error. There are 1400+ rpm's in the directory.

CommandLine:='ls /mnt/disk/redhat9/release/*.rpm';

I've looked at the TProcess code and can't seem to find any problems there. CommandToList and MakeCommand both seem to return the expected results. I've concluded the problem may be in CreateProcess... but I can't seem to run it down. Any suggestions would be appreciated! :)

-Tom

Reply by email

Mattias Gaertner
to Mattias Gaertner: On Sun, 22 Jun 2003 00:50:29 +0200 CommandLine:='bash -c "ls…
Show quoted text 25 lines
> > > > A first shot here. When you issue ls *.rpm from a shell, the * is > > expanded > > > > by your shell and it is'nt passed to ls. ls get (in your case) all > > 1400 files as argument. > > > > What you are excuting is something like ls "*.rpm" and that file does > > not exist. > > > > >I've looked at the TProcess code and can't seem to find any problems > > >there. CommandToList and MakeCommand both seem to return the expected > > >results. I've concluded the problem may be in CreateProcess... but I > > >can't seem to run it down. > > >Any suggestions would be appreciated! :) > > CommandLine:='bash -c "ls /mnt/disk/redhat9/release/*.rpm"'; Don't use bash, (even worse is to hardcode the path to be /bin) BSD systems sometimes don't have bash (they have sh as default Bourne shell already, which is enough to run standard scripts). And if they do, it is somewhere else, not in /bin. linux.shell() takes care of this IIRC.

You are right.
But if he really wanted an OS/Distribution independent solution, he would use FindFirst/Next instead of 'ls'. Probably this is for the theseus project, which is in fact Linux only.

Mattias

Reply by email

Tom Lisjac
to Marc Weustink: A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell…
Show quoted text 8 lines
>CommandLine:='ls /mnt/disk/redhat9/release/*.rpm'; A first shot here. When you issue ls *.rpm from a shell, the * is expanded by your shell and it is'nt passed to ls. ls get (in your case) all 1400 files as argument. What you are excuting is something like ls "*.rpm" and that file does not exist.

Right! I hadn't considered the shell's contribution because I don't think I've ever executed ls outside a shell before. :)

The find command is a lot "smarter" and worked perfectly as an alternative:

CommandLine:='find /mnt/disk/redhat9/release -name '+quotedstr('*.rpm');
>Any suggestions would be appreciated! :) Hope it helped.

Very much... thanks Marc! Now that I know it was a pilot error, I can stop disassembling the engine! :)

-Tom

Reply by email

Marco van de Voort
to Tom Lisjac: Yes, I saw it... thanks! TProcess is a little more convenient because it optionally…
Show quoted text 12 lines
Yes, I saw it... thanks! TProcess is a little more convenient because it optionally handles I/O redirection with the flip of a switch. This has made it very easy to put gui wrappers on large, text based utilities like rpm and cdrecord with just a few lines of code. > Probably this is for the theseus > > project, which is in fact Linux only. Epik-Builder is being developed on Linux with RH9, but the design is intended for any package format, distribution or architecture. Debian packaging is next... but I've been wondering about how well Lazarus runs under FreeBSD, so perhaps this would be a good time to ask. :)

Lazarus and the examples seems to work under FreeBSD, but I have no material to compare since I don't have Linux, or a suitable Linux userland installed under FreeBSD.

Yesterday I managed to get Lazarus running under NetBSD too, but only when statically linked.

I've the feeling the debugger sometimes hangs a short while. But maybe that was because of parameters in my gdb config file ( .gdbinit ). Does Lazarus pass parameters to gdbpas to ignore reading that file ?

P.s. is there a treeview demo somewhere?

Reply by email

Mattias Gaertner
to Tom Lisjac: There's an excellent tutorial on the TTreeview component here:…
Show quoted text 15 lines
> > P.s. is there a treeview demo somewhere? > > There's an excellent tutorial on the TTreeview component here: > > http://users.iafrica.com/d/da/dart/Delphi/TTreeView/TreeView.html Not reachable it seems, at least atm. > ... along with some nice examples that were pretty easy to convert to > Lazarus. I posted one here that illustrates adding and removing nodes: > > http://theseus.sourceforge.net/fpclaz/laztvdemo.tar.gz But this works fine (under FreeBSD even :-), maybe this can be added to examples now that treeview is part of Lazarus?

Added.

Mattias

Reply by email

Tom Lisjac
to Marco van de Voort: Lazarus and the examples seems to work under FreeBSD, but I have no material to compare…
P.s. is there a treeview demo somewhere?

There's an excellent tutorial on the TTreeview component here:

http://users.iafrica.com/d/da/dart/Delphi/TTreeView/TreeView.html

... along with some nice examples that were pretty easy to convert to Lazarus. I posted one here that illustrates adding and removing nodes:

http://theseus.sourceforge.net/fpclaz/laztvdemo.tar.gz

-Tom

Reply by email

Marco van de Voort
to Tom Lisjac
Show quoted text 5 lines
> P.s. is there a treeview demo somewhere? There's an excellent tutorial on the TTreeview component here: http://users.iafrica.com/d/da/dart/Delphi/TTreeView/TreeView.html

Not reachable it seems, at least atm.

... along with some nice examples that were pretty easy to convert to Lazarus. I posted one here that illustrates adding and removing nodes: http://theseus.sourceforge.net/fpclaz/laztvdemo.tar.gz

But this works fine (under FreeBSD even :-), maybe this can be added to examples now that treeview is part of Lazarus?

Reply by email

Marc Weustink
to Tom Lisjac: Yes, I saw it... thanks! TProcess is a little more convenient because it optionally…
Marco van de Voort wrote
I've the feeling the debugger sometimes hangs a short while. But maybe that was because of parameters in my gdb config file ( .gdbinit ). Does Lazarus pass parameters to gdbpas to ignore reading that file ?

Lazarus isn't using gdbpas. From what I onderstood when I started development, gdbpas linkes to gdb, so when gdb dumps, lazarus is gone as well. We run a gdb in a TProcess and control it through gdbmi. In this case, if your program (or gdb) dumps, lazarus can still continue.

Back to your question, since gdb is started, I guess your.gdbinit will be laoded by gdb.

Marc

Reply by email