7stud2
(7stud --)
2 September 2012 20:06
1
Hi
my bellow command
#!/usr/bin/ruby
require 'rubygems'
`parted -s /dev/cciss/c0d12 primary 0 100%`
puts $?.to_i
its showing 0, but it should show 1
because check the command line from comand line
parted -s /dev/cciss/c0d12 mkpart primary 0 100%
Error: Can't have overlapping partitions.
# echo $?
1
then why from ruby is showing different ??
thanks
···
--
Posted via http://www.ruby-forum.com/ .
#!/usr/bin/ruby
require 'rubygems'
`parted -s /dev/cciss/c0d12 primary 0 100%`
puts $?.to_i
$?'s class is Process::Status
You should use $?.exitstatus
···
On 2012-09-02 22:06, Fosiul Alam wrote:
its showing 0, but it should show 1
because check the command line from comand line
parted -s /dev/cciss/c0d12 mkpart primary 0 100%
Error: Can't have overlapping partitions.
# echo $?
1
then why from ruby is showing different ??
thanks
--
Wybo
7stud2
(7stud --)
2 September 2012 21:09
3
$?'s class is Process::Status
You should use $?.exitstatus
hi i tried that
but no luck , dont know why ..
have a look
require 'rubygems'
`parted -s /dev/cciss/c0d12 primary 0 100%`
puts $?.exitstatus
parted -s /dev/cciss/c0d12 mkpart primary 0 100%
Error: Can't have overlapping partitions.
echo $?
1
[root@us-vp-55 ~]# ruby test.rb
0
···
--
Posted via http://www.ruby-forum.com/\ .
It works here:
$ irb
irb(main):001:0> `parted -s /dev/cciss/c0d12 primary 0 100%`
=> "Error: Could not stat device /dev/cciss/c0d12 - No such file or
directory.\n"
irb(main):002:0> puts $?.exitstatus
1
=> nil
irb(main):003:0>
···
On 2012-09-02 23:09, Fosiul Alam wrote:
$?'s class is Process::Status
You should use $?.exitstatus
hi i tried that
but no luck , dont know why ..
have a look
require 'rubygems'
`parted -s /dev/cciss/c0d12 primary 0 100%`
puts $?.exitstatus
--
Wybo
7stud2
(7stud --)
2 September 2012 22:33
5
Wybo Dekker wrote in post #1074357:
`parted -s /dev/cciss/c0d12 primary 0 100%`
puts $?.exitstatus
It works here:
$ irb
irb(main):001:0> `parted -s /dev/cciss/c0d12 primary 0 100%`
=> "Error: Could not stat device /dev/cciss/c0d12 - No such file or
directory.\n"
irb(main):002:0> puts $?.exitstatus
1
=> nil
irb(main):003:0>
in my case
(irb):1: syntax error
parted -s /dev/cciss/c0d12 mkpart primary 0 100%
^
(irb):2: syntax error
puts $?.exitstatus
^
from (irb):2
irb(main):003:0>
···
On 2012-09-02 23:09, Fosiul Alam wrote:
from :0
--
Posted via http://www.ruby-forum.com/\ .
7stud2
(7stud --)
3 September 2012 03:26
6
Fosiul Alam wrote in post #1074358:
in my case
(irb):1: syntax error
parted -s /dev/cciss/c0d12 mkpart primary 0 100%
^
(irb):2: syntax error
puts $?.exitstatus
^
from (irb):2
from :0
irb(main):003:0>
What is that? How about correcting your syntax errors?
~$ irb
1.9.3p194 :001 > `parted -s /dev/cciss/c0d12 primary 0 100%`
Errno::ENOENT: No such file or directory - parted -s /dev/cciss/c0d12
primary 0 100%
from (irb):1:in ``'
from (irb):1
from /Users/7stud/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :002 > $?.exitstatus
=> 127
1.9.3p194 :003 >
···
--
Posted via http://www.ruby-forum.com/\ .