[Libguestfs] [PATCH 3/7] perl, python, ruby: Fix comments on call to close method.

Richard W.M. Jones rjones at redhat.com
Tue Jul 3 18:03:19 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

Make the comments consistent.

Also make the Perl example call $g->close explicitly so it is
consistent with the other examples.
---
 perl/examples/create_disk.pl   |    5 ++++-
 python/examples/create_disk.py |    3 +++
 ruby/examples/create_disk.rb   |    3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/perl/examples/create_disk.pl b/perl/examples/create_disk.pl
index 49538a5..fa15bc7 100755
--- a/perl/examples/create_disk.pl
+++ b/perl/examples/create_disk.pl
@@ -57,4 +57,7 @@ $g->mkdir ("/foo");
 # the disk image.
 $g->upload ("/etc/resolv.conf", "/foo/resolv.conf");
 
-exit 0
+# Note also that handles are automatically closed if they are
+# reaped by reference counting.  You only need to call close
+# if you want to close the handle right away.
+$g->close ();
diff --git a/python/examples/create_disk.py b/python/examples/create_disk.py
index bf47c91..0885383 100644
--- a/python/examples/create_disk.py
+++ b/python/examples/create_disk.py
@@ -51,4 +51,7 @@ g.mkdir ("/foo")
 # the disk image.
 g.upload ("/etc/resolv.conf", "/foo/resolv.conf")
 
+# Note also that handles are automatically closed if they are
+# reaped by reference counting.  You only need to call close
+# if you want to close the handle right away.
 g.close ()
diff --git a/ruby/examples/create_disk.rb b/ruby/examples/create_disk.rb
index 4e42cf6..026ea2e 100644
--- a/ruby/examples/create_disk.rb
+++ b/ruby/examples/create_disk.rb
@@ -54,4 +54,7 @@ g.mkdir("/foo")
 # the disk image.
 g.upload("/etc/resolv.conf", "/foo/resolv.conf")
 
+# Note also that handles are automatically closed if they are
+# reaped by the garbage collector.  You only need to call close
+# if you want to close the handle right away.
 g.close()
-- 
1.7.10.4




More information about the Libguestfs mailing list