@@ -8,7 +8,7 @@ use std::{fmt, io, mem};
8
8
use rustc_target:: spec:: LldFlavor ;
9
9
10
10
#[ derive( Clone ) ]
11
- pub struct Command {
11
+ pub ( crate ) struct Command {
12
12
program : Program ,
13
13
args : Vec < OsString > ,
14
14
env : Vec < ( OsString , OsString ) > ,
@@ -23,28 +23,28 @@ enum Program {
23
23
}
24
24
25
25
impl Command {
26
- pub fn new < P : AsRef < OsStr > > ( program : P ) -> Command {
26
+ pub ( crate ) fn new < P : AsRef < OsStr > > ( program : P ) -> Command {
27
27
Command :: _new ( Program :: Normal ( program. as_ref ( ) . to_owned ( ) ) )
28
28
}
29
29
30
- pub fn bat_script < P : AsRef < OsStr > > ( program : P ) -> Command {
30
+ pub ( crate ) fn bat_script < P : AsRef < OsStr > > ( program : P ) -> Command {
31
31
Command :: _new ( Program :: CmdBatScript ( program. as_ref ( ) . to_owned ( ) ) )
32
32
}
33
33
34
- pub fn lld < P : AsRef < OsStr > > ( program : P , flavor : LldFlavor ) -> Command {
34
+ pub ( crate ) fn lld < P : AsRef < OsStr > > ( program : P , flavor : LldFlavor ) -> Command {
35
35
Command :: _new ( Program :: Lld ( program. as_ref ( ) . to_owned ( ) , flavor) )
36
36
}
37
37
38
38
fn _new ( program : Program ) -> Command {
39
39
Command { program, args : Vec :: new ( ) , env : Vec :: new ( ) , env_remove : Vec :: new ( ) }
40
40
}
41
41
42
- pub fn arg < P : AsRef < OsStr > > ( & mut self , arg : P ) -> & mut Command {
42
+ pub ( crate ) fn arg < P : AsRef < OsStr > > ( & mut self , arg : P ) -> & mut Command {
43
43
self . _arg ( arg. as_ref ( ) ) ;
44
44
self
45
45
}
46
46
47
- pub fn args < I > ( & mut self , args : I ) -> & mut Command
47
+ pub ( crate ) fn args < I > ( & mut self , args : I ) -> & mut Command
48
48
where
49
49
I : IntoIterator < Item : AsRef < OsStr > > ,
50
50
{
@@ -58,7 +58,7 @@ impl Command {
58
58
self . args . push ( arg. to_owned ( ) ) ;
59
59
}
60
60
61
- pub fn env < K , V > ( & mut self , key : K , value : V ) -> & mut Command
61
+ pub ( crate ) fn env < K , V > ( & mut self , key : K , value : V ) -> & mut Command
62
62
where
63
63
K : AsRef < OsStr > ,
64
64
V : AsRef < OsStr > ,
@@ -71,7 +71,7 @@ impl Command {
71
71
self . env . push ( ( key. to_owned ( ) , value. to_owned ( ) ) ) ;
72
72
}
73
73
74
- pub fn env_remove < K > ( & mut self , key : K ) -> & mut Command
74
+ pub ( crate ) fn env_remove < K > ( & mut self , key : K ) -> & mut Command
75
75
where
76
76
K : AsRef < OsStr > ,
77
77
{
@@ -83,11 +83,11 @@ impl Command {
83
83
self . env_remove . push ( key. to_owned ( ) ) ;
84
84
}
85
85
86
- pub fn output ( & mut self ) -> io:: Result < Output > {
86
+ pub ( crate ) fn output ( & mut self ) -> io:: Result < Output > {
87
87
self . command ( ) . output ( )
88
88
}
89
89
90
- pub fn command ( & self ) -> process:: Command {
90
+ pub ( crate ) fn command ( & self ) -> process:: Command {
91
91
let mut ret = match self . program {
92
92
Program :: Normal ( ref p) => process:: Command :: new ( p) ,
93
93
Program :: CmdBatScript ( ref p) => {
@@ -111,17 +111,17 @@ impl Command {
111
111
112
112
// extensions
113
113
114
- pub fn get_args ( & self ) -> & [ OsString ] {
114
+ pub ( crate ) fn get_args ( & self ) -> & [ OsString ] {
115
115
& self . args
116
116
}
117
117
118
- pub fn take_args ( & mut self ) -> Vec < OsString > {
118
+ pub ( crate ) fn take_args ( & mut self ) -> Vec < OsString > {
119
119
mem:: take ( & mut self . args )
120
120
}
121
121
122
122
/// Returns a `true` if we're pretty sure that this'll blow OS spawn limits,
123
123
/// or `false` if we should attempt to spawn and see what the OS says.
124
- pub fn very_likely_to_exceed_some_spawn_limit ( & self ) -> bool {
124
+ pub ( crate ) fn very_likely_to_exceed_some_spawn_limit ( & self ) -> bool {
125
125
// We mostly only care about Windows in this method, on Unix the limits
126
126
// can be gargantuan anyway so we're pretty unlikely to hit them
127
127
if cfg ! ( unix) {
0 commit comments