Showing 1 changed files with 12 additions and 18 deletions
+12 -18
lib/Gitprep/Manager.pm
... ...
@@ -613,9 +613,8 @@ sub _create_rep {
613 613
     # Git init
614 614
     {
615 615
       my @git_init_cmd = $git->cmd_rep($rep, 'init', '--bare');
616
-      open my $fh, "-|", @git_init_cmd
617
-        or croak  "Can't open git init --bare:@git_init_cmd";
618
-      close $fh or croak  "Can't execute git init --bare:@git_init_cmd";
616
+      system(@git_init_cmd) == 0
617
+        or croak  "Can't execute git init --bare:@git_init_cmd";
619 618
     }
620 619
     
621 620
     # Add git-daemon-export-ok
... ...
@@ -631,9 +630,8 @@ sub _create_rep {
631 630
       '--bare',
632 631
       'update-server-info'
633 632
     );
634
-    open my $update_server_info_fh, "-|", @git_update_server_info_cmd
635
-      or croak "Can't open git --bare update-server-info";
636
-    close $update_server_info_fh or croak "Can't execute git --bare update-server-info";
633
+    system(@git_update_server_info_cmd) == 0
634
+      or croak "Can't execute git --bare update-server-info";
637 635
     move("$rep/hooks/post-update.sample", "$rep/hooks/post-update")
638 636
       or croak "Can't move post-update";
639 637
     
... ...
@@ -659,9 +657,8 @@ sub _create_rep {
659 657
 
660 658
       # Git init
661 659
       my @git_init_cmd = $git->cmd_rep($temp_work, 'init', '-q');
662
-      open my $init_fh, "-|", @git_init_cmd
663
-        or croak "Can't open git init: @git_init_cmd";
664
-      close $init_fh or croak "Can't execute git init: @git_init_cmd";
660
+      system(@git_init_cmd) == 0
661
+        or croak "Can't execute git init: @git_init_cmd";
665 662
       
666 663
       # Add README
667 664
       my $file = "$temp_work/README.md";
... ...
@@ -677,9 +674,8 @@ sub _create_rep {
677 674
         'add',
678 675
         'README.md'
679 676
       );
680
-      open my $add_fh, "-|", @git_add_cmd
681
-        or croak "Can't open git add: @git_add_cmd";
682
-      close $add_fh or croak "Can't execute git add: @git_add_cmd";
677
+      system(@git_add_cmd) == 0
678
+        or croak "Can't execute git add: @git_add_cmd";
683 679
       
684 680
       # Commit
685 681
       my $author = "$user <$user\@localhost>";
... ...
@@ -692,9 +688,8 @@ sub _create_rep {
692 688
         '-m',
693 689
         'first commit'
694 690
       );
695
-      open my $commit_fh, "-|", @git_commit_cmd
696
-        or croak "Can't open git commit: @git_commit_cmd";
697
-      close $commit_fh or croak "Can't execute git commit: @git_commit_cmd";
691
+      system(@git_commit_cmd) == 0
692
+        or croak "Can't execute git commit: @git_commit_cmd";
698 693
       
699 694
       # Push
700 695
       {
... ...
@@ -708,9 +703,8 @@ sub _create_rep {
708 703
         );
709 704
         # (This is bad, but --quiet option can't supress in old git)
710 705
         my $git_push_cmd = join(' ', @git_push_cmd);
711
-        open my $commit_fh, "-|", "$git_push_cmd 2> /dev/null"
712
-          or croak "Can't open git push: @git_push_cmd";
713
-        close $commit_fh or croak "Can't execute git push: @git_push_cmd";
706
+        system("$git_push_cmd 2> /dev/null") == 0
707
+          or croak "Can't execute git push: @git_push_cmd";
714 708
       }
715 709
     }
716 710
   };