Recent

Author Topic: RunCommand FPC misses output if process produces error/warning message  (Read 3701 times)

zanden30@hetnet.nl

  • New Member
  • *
  • Posts: 12
RunCommand FPC misses output if process produces error/warning message

The FPC RunCommand[InDir] both fail to produce output in the output variable whenever the called command, cUrl.exe in this case, replies an error with error/warning message. It should return the error code in the error code but nevertheless also produce the error message to the output string. See example output .pdf.

Otherwise it is impossible to handle erroneous conditions in FPC. Or I should pipe the output in a windows file with the very undesired  Exec or Executeprocess statement. So, I need a working RunCommand function…..

Or is there something that I do wrong with RunCommand?
I use FPC 3.0.2 with W10 on Dell E6410.
Example with correct TCP/IP connection and correct error message, but missing result in output string: see .pdf
 
Other "false" example, only running locally: see .pdf
 
With the correct cmd, all of the 4 variations do what they are expected to do: store output in outputstring! see .pdf
 

« Last Edit: October 02, 2017, 04:39:06 pm by zanden30@hetnet.nl »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: RunCommand FPC misses output if process produces error/warning message
« Reply #1 on: October 02, 2017, 02:49:04 pm »
Errors are probably outputted on stderr, not stdout.

Add

,[poStderrToOutPut]

to your runcommand line and retry.

P.s. the bug tracker is at bugs.freepascal.org and requires a small, representative example and all conditions needed to reproduce.

zanden30@hetnet.nl

  • New Member
  • *
  • Posts: 12
Re: RunCommand FPC misses output if process produces error/warning message
« Reply #2 on: October 02, 2017, 03:34:16 pm »
Thanks, that is the solution. Both RunCommands work now as expected! FPC is great!

I know to place bugs, but I hesistated because perhaps I did something wrong (which was actually the case.....). Excuses, I had to look to all tprocess options

 

TinyPortal © 2005-2018