Permalink
Browse files

Windows use 'NUL' instead of '/dev/null', so added the option

to use it when running in Windows
  • Loading branch information...
1 parent 2eaf9da commit 52ec7b572dcd71f1af4040df8fa4d39ad10a11f4 @fjossandon fjossandon committed Dec 27, 2013
Showing with 93 additions and 58 deletions.
  1. +2 −1 lib/Bio/Factory/EMBOSS.pm
  2. +3 −2 lib/Bio/Tools/Run/Alignment/Amap.pm
  3. +2 −1 lib/Bio/Tools/Run/Alignment/Clustalw.pm
  4. +2 −1 lib/Bio/Tools/Run/Alignment/Gmap.pm
  5. +3 −2 lib/Bio/Tools/Run/Alignment/Kalign.pm
  6. +2 −1 lib/Bio/Tools/Run/Alignment/Lagan.pm
  7. +2 −1 lib/Bio/Tools/Run/Alignment/MAFFT.pm
  8. +4 −3 lib/Bio/Tools/Run/Alignment/MSAProbs.pm
  9. +2 −1 lib/Bio/Tools/Run/Alignment/Muscle.pm
  10. +3 −2 lib/Bio/Tools/Run/Alignment/Probalign.pm
  11. +3 −2 lib/Bio/Tools/Run/Alignment/Probcons.pm
  12. +3 −2 lib/Bio/Tools/Run/Alignment/Proda.pm
  13. +2 −2 lib/Bio/Tools/Run/Alignment/Sim4.pm
  14. +4 −3 lib/Bio/Tools/Run/Alignment/StandAloneFasta.pm
  15. +2 −1 lib/Bio/Tools/Run/Coil.pm
  16. +2 −3 lib/Bio/Tools/Run/FootPrinter.pm
  17. +2 −1 lib/Bio/Tools/Run/Genscan.pm
  18. +2 −1 lib/Bio/Tools/Run/Infernal.pm
  19. +2 −1 lib/Bio/Tools/Run/MCS.pm
  20. +2 −1 lib/Bio/Tools/Run/Match.pm
  21. +3 −1 lib/Bio/Tools/Run/Meme.pm
  22. +2 −1 lib/Bio/Tools/Run/Phrap.pm
  23. +2 −1 lib/Bio/Tools/Run/Phylo/FastTree.pm
  24. +2 −1 lib/Bio/Tools/Run/Phylo/Gumby.pm
  25. +2 −1 lib/Bio/Tools/Run/Phylo/Hyphy/FEL.pm
  26. +2 −1 lib/Bio/Tools/Run/Phylo/Hyphy/SLAC.pm
  27. +2 −1 lib/Bio/Tools/Run/Phylo/LVB.pm
  28. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/Consense.pm
  29. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/DrawGram.pm
  30. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/DrawTree.pm
  31. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/Neighbor.pm
  32. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/ProtDist.pm
  33. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/ProtPars.pm
  34. +2 −1 lib/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm
  35. +2 −2 lib/Bio/Tools/Run/Phylo/Raxml.pm
  36. +2 −1 lib/Bio/Tools/Run/Phylo/Semphy.pm
  37. +2 −2 lib/Bio/Tools/Run/Primate.pm
  38. +2 −1 lib/Bio/Tools/Run/Pseudowise.pm
  39. +2 −1 lib/Bio/Tools/Run/RepeatMasker.pm
  40. +5 −5 lib/Bio/Tools/Run/TribeMCL.pm
@@ -257,9 +257,10 @@ sub _program_list {
my ($self) = @_;
if( $^O =~ /Mac/i ) { return; }
{
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
local * SAVERR;
open SAVERR, ">&STDERR";
- open STDERR, ">/dev/null";
+ open STDERR, ">$null";
open(WOSSOUT, "wossname -auto |") || return;
open STDERR, ">&SAVERR";
@@ -462,8 +462,9 @@ sub _setparams {
#FIXME: This may be only for *nixes. Double check in other OSes
$param_string .= " > ".$self->outfile_name;
- if ($self->verbose < 0) {
- $param_string .= ' 2> /dev/null';
+ if ($self->verbose < 0) {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -736,7 +736,8 @@ sub _run {
$self->debug( "Program ".$self->executable."\n");
my $commandstring = $self->executable."$instring"."$param_string";
- $commandstring .= ' 1>/dev/null' if $quiet;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $commandstring .= " 1>$null" if $quiet;
$self->debug( "clustal command = $commandstring");
my $status = system($commandstring);
@@ -324,11 +324,12 @@ EOM
sub _run {
my $self = shift;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
my $str = $self->executable;
$str .= ' -d' . ($self->genome_db() || 'NHGD_R36');
$str .= ' ' . ($self->flags() || '-f 9 -5 -e');
$str .= ' ' . $self->input_file();
- $str .= ' 2> /dev/null';
+ $str .= " 2> $null";
$str .= '; rm -f ' . $self->input_file();
$self->debug("gmap command = $str\n");
@@ -466,8 +466,9 @@ sub _setparams {
}
$param_string .= " -out ".$self->outfile_name;
- if ($self->quiet() || $self->verbose < 0) {
- $param_string .= ' 2> /dev/null';
+ if ($self->quiet() || $self->verbose < 0) {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -491,7 +491,8 @@ sub _runlagan {
if (($self->silent || $self->quiet) &&
($^O !~ /os2|dos|MSWin32|amigaos/)) {
- $command_string .= ' > /dev/null 2> /dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $command_string .= " > $null 2> $null";
}
@@ -524,7 +524,8 @@ sub _setparams {
if ($self->quiet() || $self->verbose < 0) {
$param_string .= " --quiet";
- $outputstr .= ' 2> /dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $outputstr .= " 2> $null";
}
return ($param_string, $outputstr);
}
@@ -681,10 +681,11 @@ sub _setparams {
}else{
$self->outfile_name($self->outfile);
}
- $param_string .= ' -v' if $self->verbose > 0;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= ' -v' if $self->verbose > 0;
$param_string .= ' >'.$self->outfile_name;
- $param_string .= ' 2>/dev/null' if $self->quiet &&
- $self->verbose < 1;
+ $param_string .= " 2>$null" if $self->quiet &&
+ $self->verbose < 1;
$self->arguments($param_string);
return $param_string;
}
@@ -562,7 +562,8 @@ sub _setparams {
$param_string .= " -out " . $self->outfile_name;
if ( $self->quiet() || $self->verbose < 0 ) {
- $param_string .= ' 2> /dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -451,8 +451,9 @@ sub _setparams {
#FIXME: This may be only for *nixes. Double check in other OSes
$param_string .= " > ".$self->outfile_name;
- if ($self->verbose < 0) {
- $param_string .= ' 2> /dev/null';
+ if ($self->verbose < 0) {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -485,8 +485,9 @@ sub _setparams {
#FIXME: This may be only for *nixes. Double check in other OSes
$param_string .= " $infilename > ".$self->outfile_name;
- if ($self->verbose < 0) {
- $param_string .= ' 2> /dev/null';
+ if ($self->verbose < 0) {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -455,8 +455,9 @@ sub _setparams {
#FIXME: This may be only for *nixes. Double check in other OSes
$param_string .= " > ".$self->outfile_name;
- if ($self->verbose < 0) {
- $param_string .= ' 2> /dev/null';
+ if ($self->verbose < 0) {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null";
}
return $param_string;
}
@@ -289,7 +289,8 @@ sub _run {
my $outfile = $self->outfile();
my $commandstring = $self->executable." $infile1 $infile2 $param_string > $outfile";
if($self->quiet || $self->silent || ($self->verbose < 0)){
- $commandstring .= " 2>/dev/null";
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $commandstring .= " 2>$null";
}
$self->debug( "Sim4 command = $commandstring");
my $status = system($commandstring);
@@ -391,4 +392,3 @@ sub _setparams {
}
1; # Needed to keep compiler happy
-
@@ -315,7 +315,8 @@ sub run {
-format=>"fasta");
} else {
if ( $self->verbose() < 0) {
- $para .= ' >/dev/null 2>/dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $para .= " >$null 2>$null";
} else {
$self->debug("Going to execute: $para");
}
@@ -351,7 +352,8 @@ sub run {
-format=>"fasta");
} else {
if ( $self->verbose() < 0) {
- $para .= ' >/dev/null 2>/dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $para .= " >$null 2>$null";
} else {
$self->debug("Going to execute: $para");
}
@@ -549,4 +551,3 @@ sub _setparams {
1;
__END__
-
@@ -266,7 +266,8 @@ sub _run {
my ($tfh1,$outfile) = $self->io->tempfile(-dir=>$self->tempdir());
my $str =$self->executable." -f < ".$self->{'input'}." > ".$outfile;
if($self->quiet || $self->verbose <=0 || $self->silent){
- $str.=" 2>/dev/null";
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $str.=" 2>$null";
}
my $status = system($str);
$self->throw( "Coil call ($str) crashed: $? \n") unless $status==0;
@@ -335,7 +335,8 @@ sub _run {
$self->debug("FootPrinter command = $cmd_str");
if ($self->verbose <=0){
- $cmd_str.=" >&/dev/null > /dev/null";
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $cmd_str.= " >&$null > $null";
}
# will do brute-force clean up of junk files generated by FootPrinter
@@ -544,5 +545,3 @@ sub _setinput {
=cut
1;
-
-
@@ -199,7 +199,8 @@ sub _run {
$str.=" -v ";
}
if($self->quiet){
- open(STDERR,">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(STDERR,">$null");
}
unless (open(GENSCAN, "$str |")){
$self->warn("Cannot run $str");
@@ -922,7 +922,8 @@ sub to_exe_string {
if ($prog eq 'cmalign') {
push @{$args{switch}}, '-q' if !exists $params{q};
} else {
- push @{$args{redirect}}, '> /dev/null';
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ push @{$args{redirect}}, "> $null";
}
}
View
@@ -324,7 +324,8 @@ sub _setparams {
-switches => \@SWITCHES,
-dash => 1);
- $param_string .= ' 1>/dev/null' if $self->quiet;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 1>$null" if $self->quiet;
return $param_string;
}
@@ -279,7 +279,8 @@ sub _setparams {
my $param_string = $self->SUPER::_setparams(-switches => \@SWITCHES,
-dash => 1);
- $param_string .= ' 1>/dev/null' if $self->quiet;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 1>$null" if $self->quiet;
return $param_string;
}
@@ -299,7 +299,9 @@ sub _setparams {
-dash => 1);
$param_string .= " > $outfile";
- $param_string .= ' 2> /dev/null' if $self->quiet || $self->verbose < 0;
+
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null" if $self->quiet || $self->verbose < 0;
return $param_string;
}
@@ -397,7 +397,8 @@ sub _run {
my $options = join ' ', @{$self->_translate_params()};
# Usage: phrap seq_file1 [seq_file2 ...] [-option value] [-option value] ...
- my $str = "$exe $options $fasta_file 1> $output_file 2> /dev/null";
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ my $str = "$exe $options $fasta_file 1> $output_file 2> $null";
if ($self->verbose() >= 0) {
$self->debug( "$exe command = $str\n" );
};
@@ -361,7 +361,8 @@ sub _setparams {
}
$param_string .= " $infile > " . $self->outfile_name;
- $param_string .= ' 2> /dev/null' if ( $self->quiet() || $self->verbose < 0 );
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ $param_string .= " 2> $null" if ( $self->quiet() || $self->verbose < 0 );
$param_string;
}
@@ -411,14 +411,15 @@ sub _run {
sub _setparams {
my ($self, $aln_file, $tree_file) = @_;
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
my $param_string = ' '.$tree_file;
$param_string .= ' '.$aln_file;
$param_string .= $self->SUPER::_setparams(-params => \@PARAMS,
-switches => \@SWITCHES,
-dash => 1,);
$param_string .= ' -o out';
$param_string .= ' 2>&1';
- $param_string .= ' 1>/dev/null' if $self->quiet;
+ $param_string .= " 1>$null" if $self->quiet;
return $param_string;
}
@@ -128,6 +128,7 @@ essentially lifted from the python wrapper or provided by the author.
sub valid_values {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
return
(
{'geneticCode' => [ "Universal","VertebratemtDNA","YeastmtDNA","Mold/ProtozoanmtDNA",
@@ -139,7 +140,7 @@ sub valid_values {
{ "Default" => undef } ]
},
{'temptreefile' => undef }, # tree file goes here
- {'Model Fit Results' => [ '/dev/null'] }, # this will not work under Windows
+ {'Model Fit Results' => [ $null] }, # Windows have NUL instead of /dev/null
{'dN/dS bias parameter' => [ { "Estimate dN/dS only" => undef },
{ "Neutral" => undef },
{ "Estimate" => undef },
@@ -127,6 +127,7 @@ essentially lifted from the python wrapper or provided by the author.
sub valid_values {
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
return
(
{'geneticCode' => [ "Universal","VertebratemtDNA","YeastmtDNA","Mold/ProtozoanmtDNA",
@@ -138,7 +139,7 @@ sub valid_values {
{ "Default" => undef } ]
},
{'temptreefile' => undef }, # tree file goes here
- {'Model Fit Results' => [ '/dev/null'] }, # this will not work under Windows
+ {'Model Fit Results' => [ $null] }, # Windows have NUL instead of /dev/null
{'dN/dS bias parameter' => [ { "Estimate dN/dS only" => undef },
{ "Neutral" => undef },
{ "Estimate" => undef },
@@ -335,7 +335,8 @@ sub _run {
chdir($self->tempdir);
#open a pipe to run lvb to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(LVB_PIPE,"|".$self->executable.">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(LVB_PIPE,"|".$self->executable.">$null");
}
else {
open(LVB_PIPE,"|".$self->executable);
@@ -388,7 +388,8 @@ sub _run {
chdir($self->tempdir);
# open a pipe to run Consense to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(Consense,"| ".$self->executable .">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(Consense,"| ".$self->executable .">$null");
}
else {
open(Consense,"| ".$self->executable);
@@ -271,7 +271,8 @@ sub _run {
$self->debug( "Program ".$self->executable." $param_string\n");
# open a pipe to run drawgram to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(DRAW,"|".$self->executable.">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(DRAW,"|".$self->executable.">$null");
}
else {
open(DRAW,"|".$self->executable);
@@ -295,7 +295,8 @@ sub _run {
$self->debug( "Program ".$self->executable." $param_string\n");
# open a pipe to run drawgram to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(DRAW,"|".$self->executable.">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(DRAW,"|".$self->executable.">$null");
}
else {
open(DRAW,"|".$self->executable);
@@ -423,7 +423,8 @@ sub _run {
chdir($self->tempdir);
#open a pipe to run neighbor to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(NEIGHBOR,"|".$self->executable.">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(NEIGHBOR,"|".$self->executable.">$null");
}
else {
open(NEIGHBOR,"|".$self->executable);
@@ -421,7 +421,8 @@ sub _run {
chdir($self->tempdir);
#open a pipe to run protdist to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(PROTDIST,"|".$self->executable .">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(PROTDIST,"|".$self->executable .">$null");
}
else {
open(PROTDIST,"|".$self->executable);
@@ -355,7 +355,8 @@ sub _run {
chdir($self->tempdir);
#open a pipe to run protpars to bypass interactive menus
if ($self->quiet() || $self->verbose() < 0) {
- open(PROTPARS,"|".$self->executable.">/dev/null");
+ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
+ open(PROTPARS,"|".$self->executable.">$null");
}
else {
open(PROTPARS,"|".$self->executable);
Oops, something went wrong.

0 comments on commit 52ec7b5

Please sign in to comment.