Problems with PipeableOSProcess
Hi everyone, I'm currently experiencing problems with PipeableOSProcess. I'm using a command to run a third party tool, which reads a txt file and returns an XML string. In my collection, this works fine for about 75 out of 100 txt files, but fails on the remaining 25 ones. However, the tool itself doesn't fail. It works fine, if I issue the commands directly from a Terminal. Here's an example of a command string that works: /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF sFromList/Ache00aScriptingCoordStyles.pdf.txt And here's an example of one that doesn't work. /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF sFromList/Ardi97aSchemeTeaching.pdf.txt This is how I apply these commands through PipeableOSProcess: xml := (PipeableOSProcess command: cmdString) output. For the first command, xml is a large XML string, for the second command, it's just an empty string. As I've mentioned above, both commands work just fine in a Terminal. They both produce a correct XML string. Does anyone have an idea why this could be the case? Is there a way to access errors in the PipeableOSProcess, if there are any? Is there a better way to issue terminal commands from Pharo? Thanks for your help! Cheers, Silas
On Wed, Mar 1, 2017 at 8:47 PM, Silas Berger <silas.berger@students.unibe.ch> wrote:
Hi everyone,
Iâm currently experiencing problems with PipeableOSProcess. Iâm using a
command to run a third party tool, which reads a txt file and returns an XML string. In my collection, this works fine for about 75 out of 100 txt files, but fails on the remaining 25 ones. However, the tool itself doesnât fail. It works fine, if I issue the commands directly from a Terminal.
Hereâs an example of a command string that works:
/Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ache00aScriptingCoordStyles.pdf.txt
And hereâs an example of one that doesnât work.
/Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDFsFromList/Ardi97aSchemeTeaching.pdf.txt
This is how I apply these commands through PipeableOSProcess:
xml := (PipeableOSProcess command: cmdString) output.
For the first command, xml is a large XML string, for the second command,
itâs just an empty string. Sorry I don't know the answers your seek - but just to clarify something. How significant is that empty string return? cheers -ben
Hi Silas, I am travelling and cannot help much right now, but to answer one of your questions - yes, you can inspect errors in a PipeableOSProcess. It has an "error pipeline stream" that will contain any output from the stderr stream of the process. It also has a process proxy for the actual external OS process, which will show exit status for the process. In your case that probably will not help much, because you will just see exit status for the /bin/shell that you ran, not for the process that ran your perl script. Nevertheless it may be interesting to check it. One possible source of problems in a case like this is command line parsing. The command line that you pass from Pharo may get parsed differently than a normal bash terminal shell, especially with respect to quoting strings. Also, you refer to an empty string, which certainly sounds like it is related to the problem, although I cannot say why. Dave
Hi everyone,
I'm currently experiencing problems with PipeableOSProcess. I'm using a command to run a third party tool, which reads a txt file and returns an XML string. In my collection, this works fine for about 75 out of 100 txt files, but fails on the remaining 25 ones. However, the tool itself doesn't fail. It works fine, if I issue the commands directly from a Terminal.
Here's an example of a command string that works:
/Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF sFromList/Ache00aScriptingCoordStyles.pdf.txt
And here's an example of one that doesn't work.
/Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/tools/mac/ parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/ExtendedEggShell/Moose6.0/ExtendedEggShell/examplePDF sFromList/Ardi97aSchemeTeaching.pdf.txt
This is how I apply these commands through PipeableOSProcess:
xml := (PipeableOSProcess command: cmdString) output.
For the first command, xml is a large XML string, for the second command, it's just an empty string. As I've mentioned above, both commands work just fine in a Terminal. They both produce a correct XML string.
Does anyone have an idea why this could be the case? Is there a way to access errors in the PipeableOSProcess, if there are any? Is there a better way to issue terminal commands from Pharo?
Thanks for your help!
Cheers,
Silas
participants (3)
-
Ben Coman -
David T. Lewis -
Silas Berger