@@ -18,6 +18,9 @@ pub enum FromEnvErrorKind {
18
18
/// There is no jobserver in the environment variable.
19
19
/// Variables associated with Make can be used for passing data other than jobserver info.
20
20
NoJobserver ,
21
+ /// Environment variable contains negative file descriptors which means
22
+ /// jobserver is disabled for this process
23
+ NegativeFd ,
21
24
/// Cannot parse jobserver environment variable value, incorrect format.
22
25
CannotParse ,
23
26
/// Cannot open path or name from the jobserver environment variable value.
@@ -36,6 +39,7 @@ impl FromEnvError {
36
39
match self . inner {
37
40
FromEnvErrorInner :: NoEnvVar => FromEnvErrorKind :: NoEnvVar ,
38
41
FromEnvErrorInner :: NoJobserver => FromEnvErrorKind :: NoJobserver ,
42
+ FromEnvErrorInner :: NegativeFd ( ..) => FromEnvErrorKind :: NegativeFd ,
39
43
FromEnvErrorInner :: CannotParse ( _) => FromEnvErrorKind :: CannotParse ,
40
44
FromEnvErrorInner :: CannotOpenPath ( ..) => FromEnvErrorKind :: CannotOpenPath ,
41
45
FromEnvErrorInner :: CannotOpenFd ( ..) => FromEnvErrorKind :: CannotOpenFd ,
@@ -50,6 +54,7 @@ impl std::fmt::Display for FromEnvError {
50
54
match & self . inner {
51
55
FromEnvErrorInner :: NoEnvVar => write ! ( f, "there is no environment variable that describes jobserver to inherit" ) ,
52
56
FromEnvErrorInner :: NoJobserver => write ! ( f, "there is no `--jobserver-fds=` or `--jobserver-auth=` in the environment variable" ) ,
57
+ FromEnvErrorInner :: NegativeFd ( read, write) => write ! ( f, "either or both passed file descriptors are negative: {read}, {write}" ) ,
53
58
FromEnvErrorInner :: CannotParse ( s) => write ! ( f, "cannot parse jobserver environment variable value: {s}" ) ,
54
59
FromEnvErrorInner :: CannotOpenPath ( s, err) => write ! ( f, "cannot open path or name {s} from the jobserver environment variable value: {err}" ) ,
55
60
FromEnvErrorInner :: CannotOpenFd ( fd, err) => write ! ( f, "cannot open file descriptor {fd} from the jobserver environment variable value: {err}" ) ,
@@ -76,6 +81,7 @@ impl std::error::Error for FromEnvError {
76
81
pub ( crate ) enum FromEnvErrorInner {
77
82
NoEnvVar ,
78
83
NoJobserver ,
84
+ NegativeFd ( RawFd , RawFd ) ,
79
85
CannotParse ( String ) ,
80
86
CannotOpenPath ( String , std:: io:: Error ) ,
81
87
CannotOpenFd ( RawFd , std:: io:: Error ) ,
0 commit comments