# More 'system call' troubleshooting

**URL:** <https://www.ruby-forum.com/t/more-system-call-troubleshooting/91707>\
**Category:** Ruby\
**Created:** [April 11, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/more-system-call-troubleshooting/91707 "2007-04-11T19:35:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [April 11, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/more-system-call-troubleshooting/91707/1 "2007-04-11T19:35:27Z")

</div>

Something that isn’t mentioned in the Ruby manual online (http://  
[www.rubycentral.com/book/ref\_m\_kernel.html#Kernel.system](http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.system)) is that the  
entire path is needed as well.

Of course, that is a best practice, but I spent some time working  
through this as an issue.

Additionally, I wrote a short test.sh script that does an exit with a  
value. The command I used in ruby was:

retval = system(“/path/to/test.sh”)

when this is run the values for ‘retval’ and $? are as follows:

#exit 0 → true $?=0  
#exit 1 → false $?=256  
#exit 2 → false $?=512  
#exit 3 → false $?=768  
#exit 4 → false $?=1024  
#exit 5 → false $?=1280  
#exit -1 → false $?=65280

Can anyone explain the $? values? It is supposed to contain a  
‘detailed error code’.

By the looks of it, some sort of multiple of 256.

Mike B.

---

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [April 11, 2007, 7:56pm UTC](https://www.ruby-forum.com/t/more-system-call-troubleshooting/91707/2 "2007-04-11T19:56:26Z")

</div>

barjunk wrote:

> Can anyone explain the $? values? It is supposed to contain a  
> ‘detailed error code’.

$? is a Process::Status value.

ri Process::Status
