@@ -478,14 +478,13 @@ fn install_one_crate(c: cargo, path: str, cf: str) {
478
478
( exec_suffix == "" && !str:: starts_with( path:: basename( ct) ,
479
479
"lib" ) ) {
480
480
#debug( " bin: %s" , ct) ;
481
- // FIXME: need libstd os::copy or something (Issue #1983)
482
- run:: run_program( "cp" , [ ct, c. bindir] ) ;
481
+ copy_warn( ct, c. bindir) ;
483
482
if c. opts. mode == system_mode {
484
483
install_one_crate_to_sysroot( ct, "bin" ) ;
485
484
}
486
485
} else {
487
486
#debug( " lib: %s" , ct) ;
488
- run :: run_program ( "cp" , [ ct, c. libdir ] ) ;
487
+ copy_warn ( ct, c. bindir ) ;
489
488
if c. opts. mode == system_mode {
490
489
install_one_crate_to_sysroot( ct, libdir( ) ) ;
491
490
}
@@ -499,10 +498,7 @@ fn install_one_crate_to_sysroot(ct: str, target: str) {
499
498
let path = [ _path, ".." , target] ;
500
499
check vec:: is_not_empty( path) ;
501
500
let target_dir = path:: normalize( path:: connect_many( path) ) ;
502
- let p = run:: program_output( "cp" , [ ct, target_dir] ) ;
503
- if p. status != 0 {
504
- warn( #fmt[ "Copying %s to %s is failed" , ct, target_dir] ) ;
505
- }
501
+ copy_warn( ct, target_dir) ;
506
502
}
507
503
none { }
508
504
}
@@ -772,7 +768,7 @@ fn sync_one(c: cargo, name: str, src: source) {
772
768
info( #fmt[ "no signature for source %s" , name] ) ;
773
769
}
774
770
}
775
- run :: run_program ( "cp" , [ pkgfile, destpkgfile] ) ;
771
+ copy_warn ( pkgfile, destpkgfile) ;
776
772
}
777
773
778
774
fn cmd_sync ( c : cargo ) {
@@ -812,7 +808,7 @@ fn cmd_init(c: cargo) {
812
808
} else {
813
809
info ( #fmt[ "signature ok for sources.json" ] ) ;
814
810
}
815
- run :: run_program ( "cp" , [ srcfile, destsrcfile] ) ;
811
+ copy_warn ( srcfile, destsrcfile) ;
816
812
817
813
info ( #fmt[ "Initialized .cargo in %s" , c. root ] ) ;
818
814
}
@@ -853,6 +849,12 @@ fn cmd_search(c: cargo) {
853
849
info ( #fmt[ "Found %d packages." , n] ) ;
854
850
}
855
851
852
+ fn copy_warn ( src : str , dest : str ) {
853
+ if !os:: copy_file ( src, dest) {
854
+ warn ( #fmt[ "Copying %s to %s failed" , src, dest] ) ;
855
+ }
856
+ }
857
+
856
858
fn cmd_usage ( ) {
857
859
print ( "Usage: cargo <verb> [options] [args...]" +
858
860
"
0 commit comments