Open3.capture2e returning nil status?

67 views
Skip to first unread message

Thibaut Barrère

unread,
May 2, 2012, 2:55:45 PM5/2/12
to rubyin...@googlegroups.com
Hello,

not sure if that's related to Ruby on Windows or just with Ruby, as I am having a hard time reproducing this (production is on Windows).

I am meeting erratic and hard-to-reproduce situations where calling Open3.capture2e will return an nil status:

output, status = Open3.capture2e(command)

is that something that has already been met by someone else on Windows?

thanks for any hint!

-- Thibaut

Luis Lavena

unread,
May 2, 2012, 4:08:56 PM5/2/12
to rubyin...@googlegroups.com
On Wed, May 2, 2012 at 3:55 PM, Thibaut Barrère
<thibaut...@gmail.com> wrote:
> Hello,
>

Hello Thibaut,
I heard lot of things in relation to Open3, but there are like 3 or 4
different libraries that tackle Open3/Open4 differently.

Would you mind provide details in relation with:

- Version of Ruby you're using (ruby -v)
- Open3 gem (if used, which one) and version
- Command that is being sent to Open3
- What is the output when status is nil?

Ruby back in 1.8.6 used to return nil for $? (process exit status)
when it failed to execute some commands. Back then Rake used to report
that exitstatus didn't exist in NilClass, which was true.

Perhaps this is a similar one, in which case we need the above details.

Looking forward your comments.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Thibaut Barrère

unread,
May 3, 2012, 3:26:07 PM5/3/12
to rubyin...@googlegroups.com
Hello Luis,

here are more details:
 
- Version of Ruby you're using (ruby -v)

ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
 
- Open3 gem (if used, which one) and version

I am just using the built-in "require 'open3'" without a specific gem (should I be using a gem instead?).
 
- Command that is being sent to Open3

It is something along the lines of :

"C:\Program Files\AR System\runmacro.exe" -t csv -a -x "[FILTERED]" -U "[FILTERED]" -P "[FILTERED]" -s "[FORM]" -o "c:/xxx/data/form.csv" -q "'3' >= 1336066338 OR '6' >= 1336066338" 

This command achieves change data capture on a CRM, then processed by a Ruby ETL (if you wonder :-).
 
- What is the output when status is nil?

I can't tell yet - but I just deployed a patch to production to log this down when it happens next time.

Ruby back in 1.8.6 used to return nil for $? (process exit status)
when it failed to execute some commands. Back then Rake used to report
that exitstatus didn't exist in NilClass, which was true.
Perhaps this is a similar one, in which case we need the above details.
Looking forward your comments.

Interesting - currently I consider nil status is a sign of error, out of precaution.

I will report back with more output (eg: is there something in there?) as soon as possible.

Thibaut
--

Luis Lavena

unread,
May 3, 2012, 3:37:48 PM5/3/12
to rubyin...@googlegroups.com

Sorry for top posting. Sent from mobile.

On May 3, 2012 4:26 PM, "Thibaut Barrère" <thibaut...@gmail.com> wrote:
>
> Hello Luis,
>
> here are more details:
>  
>>
>> - Version of Ruby you're using (ruby -v)
>
>
> ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
>  
>>
>> - Open3 gem (if used, which one) and version
>
>
> I am just using the built-in "require 'open3'" without a specific gem (should I be using a gem instead?).
>

Actually of you're using 1.9.3 in production, see if you can use Process.spawn instead.

Thibaut Barrère

unread,
May 5, 2012, 11:47:41 AM5/5/12
to rubyin...@googlegroups.com
Hi Luis,
 

> I am just using the built-in "require 'open3'" without a specific gem (should I be using a gem instead?).

Actually of you're using 1.9.3 in production, see if you can use Process.spawn instead.

I will try that instead, thanks; are there known issues with the built-in open3, out of curiosity?

Thibaut
--

Luis Lavena

unread,
May 5, 2012, 11:51:28 AM5/5/12
to rubyin...@googlegroups.com
None that I'm aware of, but it hasn't been in my radar since 1.9.2/3
provided Process.spawn that can do much more.

Thibaut Barrère

unread,
May 6, 2012, 3:31:31 AM5/6/12
to rubyin...@googlegroups.com
> None that I'm aware of, but it hasn't been in my radar since 1.9.2/3
> provided Process.spawn that can do much more.

ok thanks! I will give spawn a go and will report back.

-- Thibaut
Reply all
Reply to author
Forward
0 new messages