Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 1.4k
    • Issues 1.4k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 84
    • Merge requests 84
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPCFPC
  • FPC SourceFPC Source
  • Issues
  • #14446
Closed
Open
Issue created Aug 27, 2009 by FPC Admin account@fpc_adminOwner

TProcess cannot execute a command

Original Reporter info from Mantis: ggeldenhuys
  • Reporter name: Graeme Geldenhuys

Description:

This email describes the issue.

----------[ forward ]----------------
Mattias Gaertner wrote:

On Thu, 27 Aug 2009 11:23:52 +0200
Graeme Geldenhuys &LtPos;graemeg@opensoft.homeip.net> wrote:

Hi,

As far as I know, Lazarus doesn't have a Thread List Window available.
So I am trying to setup and external tools menu item which will do
this for me, but I am have some problems with it.

This is the actual setup strings used for the external tool.

Program Filename:
/usr/bin/gnome-terminal

Parameters:
--title="Thread Monitor - $NameOnly($TargetFile())" --command="watch
-n.1 'ps -C $NameOnly($TargetFile()) -L -o pid,tid,pcpu,state'"


When I run Lazarus from the command line under Linux, this is the
output shown to stdout when I try and run my external tool.

[TExternalToolList.Run] CmdLine="/usr/bin/gnome-terminal
--title="Thread Monitor - project1" --command="watch -n.1 'ps -C
project1 -L -o pid,tid,pcpu,state'"" WorkDir=""


As far as I can see the macros used in the External Tool step was
converted correctly. I can even copy and paste the CmdLine without the
outer quotes and it executes fine from a teminal window. Yet, if I run
it from the Tools menu gnome-terminal gives an error. The error is:
"There was an error creating the child process for this terminal"

Anybody know what I am doing wrong?


It is a bug in fcl-process/src/unix/process.inc proc CommandToList
used by TProcess.
It only removes the outer ".
Please report it.

Mattias

--------------------------

I even tried putting my command in a executable shell script as shown below, and that did not work either.

----------[ ~/bin/lsthreads ]------------------
/usr/bin/gnome-terminal --title="Thread Monitor" \
   --command="watch -n.1 'ps -C ${1} -L -o pid,tid,pcpu,state'"
----------------[ end ]------------------

and here is a small test project...

--------[ small test program ]-------------
program project1;

{$mode objfpc}{$H+}

uses
  Classes, process;
 
var
  t: TProcess;
  sl: TStringList;
begin
  t := TProcess.Create(nil);
  t.Options := [poWaitOnExit];

  // this gives an error
//  t.CommandLine := '/usr/bin/gnome-terminal --title="Thread Monitor - project1" --command="watch -n.1 ''ps -C project1 -L -o pid,tid,pcpu,state''" ';

  // this doesn't show anything
  t.CommandLine := 'lsthreads lazarus';

  // this one works
  //t.CommandLine := 'top';

  t.Execute;
  writeln('Press <ENTER> to continue...');
  readln;
  t.Free;
end.
--------------[ end ]-------------------

Mantis conversion info:

  • Mantis ID: 14446
  • OS: Ubuntu Linux 9.04
  • Build: r13573
  • Platform: x86_64 & i386
  • Version: 2.3.1
  • Fixed in version: 2.6.0
  • Fixed in revision: 17379 (#49cf3958)
  • Monitored by: » @michaliskambi (Michalis Kamburelis)
  • Target version: 2.6.0
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking