[svn:parrot] r45942 - in trunk/runtime/parrot/library: . TAP
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Fri Apr 23 18:37:52 UTC 2010
Author: fperrad
Date: Fri Apr 23 18:37:52 2010
New Revision: 45942
URL: https://trac.parrot.org/parrot/changeset/45942
Log:
[TAP] use GzipHandle PMC (instead of gzip)
Modified:
trunk/runtime/parrot/library/TAP/Harness.pir
trunk/runtime/parrot/library/osutils.pir
Modified: trunk/runtime/parrot/library/TAP/Harness.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Harness.pir Fri Apr 23 18:35:32 2010 (r45941)
+++ trunk/runtime/parrot/library/TAP/Harness.pir Fri Apr 23 18:37:52 2010 (r45942)
@@ -339,8 +339,7 @@
cmd .= " *"
system(cmd)
chdir(current_dir)
- cmd = "gzip --best " . $S0
- system(cmd)
+ gzip($S0)
rmtree(dir)
.return (aggregate)
.end
Modified: trunk/runtime/parrot/library/osutils.pir
==============================================================================
--- trunk/runtime/parrot/library/osutils.pir Fri Apr 23 18:35:32 2010 (r45941)
+++ trunk/runtime/parrot/library/osutils.pir Fri Apr 23 18:37:52 2010 (r45942)
@@ -764,6 +764,48 @@
L7:
.end
+=item gzip
+
+=cut
+
+.sub 'gzip'
+ .param string filename
+ .local pmc fh, gh
+ fh = new 'FileHandle'
+ push_eh _handler1
+ $S0 = fh.'readall'(filename)
+ $I0 = length $S0
+ pop_eh
+ $P0 = loadlib 'gziphandle'
+ push_eh _handler2
+ gh = new 'GzipHandle'
+ $S1 = filename . '.gz'
+ gh.'open'($S1, 'wb')
+ gh.'puts'($S0)
+ gh.'close'()
+ unlink(filename)
+ .return ()
+ _handler1:
+ .local pmc e
+ .get_results (e)
+ $S0 = "Can't open '"
+ $S0 .= filename
+ $S0 .= "' ("
+ $S1 = err
+ $S0 .= $S1
+ $S0 .= ")\n"
+ e = $S0
+ rethrow e
+ _handler2:
+ .local pmc e
+ .get_results (e)
+ $S0 = "Can't gzip '"
+ $S0 .= filename
+ $S0 .= "'\n"
+ e = $S0
+ rethrow e
+.end
+
=back
=head1 AUTHOR
More information about the parrot-commits
mailing list