Working bash command fails with OSSubprocess depending on input file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Working bash command fails with OSSubprocess depending on input file

Silas Berger

Hi everyone,

 

I’m currently having problems with executing bash commands through OSSubprocess (version: #stable, as of today) on OS X 10.11.6. I’m using the command line tools of a program called ParseCit to extract metadata from .txt files. It works well for about 75% of all txt files I’ve tested it with, but fails on the remaining 25%. This isn’t due to ParseCit though, since it works on all input files, when I issue the command directly from a bash. I’ve prepared two test txt files – one that works fine (goodExample.txt) and one that doesn’t work (badExample.txt) with OSSubprocess. The conversion for both files works fine when issuing the following respective commands in a shell or bash:

               

                /Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/badExample.txt

/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/goodExample.txt

 

Using OSSubprocess, it works well for goodExample.txt, the result looks like this:

 

Unfortunately, that exact same method/command fails, if the target file is badExample.txt instead.

 

Below, you can find two methods I’ve tried for badExaple.txt, neither of which work. Method 2 (which is the one I used in the above screenshot for goodExample.txt) has a stderr stream, its contents are just above the Method 2 screenshot. It looks like it should be a ParseCit problem, but, as I’ve mentioned above, it works fine when done directly in a bash or shell.

 

In this GitHub repo there are the “tools” folder containing a compiled version of ParseCit, a corresponding INSTALL.md with all the necessary install steps for ParseCit, and a folder “test_txt”, which contains goodExample.txt and badExample.txt. The EES-INSTALL.md in the same repo is not relevant in this context.

 

If anyone has an idea what could be the problem or how I could get it to work, I’d be very happy.

 

Best,

Silas

 

 

*** Methods I’ve tried ***

 

Method 1

Result: Empty stdout, empty stderr, exit status 65280

 

 

Method 2

Result: Empty stdout, exit status 65280,

Stderr:

/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/sectLabel/genericSect/extractFeature.rb:35:in `split': invalid byte sequence in US-ASCII (ArgumentError)

                from /Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/sectLabel/genericSect/extractFeature.rb:35:in `<main>'

Die: SectLabel::Controller::getGenericHeaders different in number of headers 8 vs. the number of generic headers 0

 

 

*** The commands ***

 

p1 := OSSUnixSubprocess new

    command: '/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl';

    arguments: #('-m' 'extract_all' '/Users/silas/Documents/TestWithOSS/test_txt/badExample.txt');

    redirectStdout;

                redirectStderr;

    runAndWaitOnExitDo: [ :process :outString  |

        outString inspect

    ].

 

 

p3 := OSSUnixSubprocess new

                shell: '/bin/bash'

    command: '/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/badExample.txt';

    redirectStdout;

                redirectStderr;

    runAndWaitOnExitDo: [ :process :outString  |

        outString inspect

    ].

Reply | Threaded
Open this post in threaded view
|

Re: Working bash command fails with OSSubprocess depending on input file

Mariano Martinez Peck
Hi Silas, 

Sorry for the delayed answer but I am very busy at work. Have you had any success since that email? Else I will try to take a look later today. 

Was this on Pharo 5.0 or 6 ?

Thanks, 

On Wed, Mar 8, 2017 at 12:09 PM, Silas Berger <[hidden email]> wrote:

Hi everyone,

 

I’m currently having problems with executing bash commands through OSSubprocess (version: #stable, as of today) on OS X 10.11.6. I’m using the command line tools of a program called ParseCit to extract metadata from .txt files. It works well for about 75% of all txt files I’ve tested it with, but fails on the remaining 25%. This isn’t due to ParseCit though, since it works on all input files, when I issue the command directly from a bash. I’ve prepared two test txt files – one that works fine (goodExample.txt) and one that doesn’t work (badExample.txt) with OSSubprocess. The conversion for both files works fine when issuing the following respective commands in a shell or bash:

               

                /Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/badExample.txt

/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/goodExample.txt

 

Using OSSubprocess, it works well for goodExample.txt, the result looks like this:

 

Unfortunately, that exact same method/command fails, if the target file is badExample.txt instead.

 

Below, you can find two methods I’ve tried for badExaple.txt, neither of which work. Method 2 (which is the one I used in the above screenshot for goodExample.txt) has a stderr stream, its contents are just above the Method 2 screenshot. It looks like it should be a ParseCit problem, but, as I’ve mentioned above, it works fine when done directly in a bash or shell.

 

In this GitHub repo there are the “tools” folder containing a compiled version of ParseCit, a corresponding INSTALL.md with all the necessary install steps for ParseCit, and a folder “test_txt”, which contains goodExample.txt and badExample.txt. The EES-INSTALL.md in the same repo is not relevant in this context.

 

If anyone has an idea what could be the problem or how I could get it to work, I’d be very happy.

 

Best,

Silas

 

 

*** Methods I’ve tried ***

 

Method 1

Result: Empty stdout, empty stderr, exit status 65280

 

 

Method 2

Result: Empty stdout, exit status 65280,

Stderr:

/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/sectLabel/genericSect/extractFeature.rb:35:in `split': invalid byte sequence in US-ASCII (ArgumentError)

                from /Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/sectLabel/genericSect/extractFeature.rb:35:in `<main>'

Die: SectLabel::Controller::getGenericHeaders different in number of headers 8 vs. the number of generic headers 0

 

 

*** The commands ***

 

p1 := OSSUnixSubprocess new

    command: '/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl';

    arguments: #('-m' 'extract_all' '/Users/silas/Documents/TestWithOSS/test_txt/badExample.txt');

    redirectStdout;

                redirectStderr;

    runAndWaitOnExitDo: [ :process :outString  |

        outString inspect

    ].

 

 

p3 := OSSUnixSubprocess new

                shell: '/bin/bash'

    command: '/Users/silas/Documents/TestWithOSS/tools/mac/parsecit/bin/citeExtract.pl -m extract_all /Users/silas/Documents/TestWithOSS/test_txt/badExample.txt';

    redirectStdout;

                redirectStderr;

    runAndWaitOnExitDo: [ :process :outString  |

        outString inspect

    ].




--