File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ extension Error: CustomStringConvertible {
36
36
@noreturn public func handleError( msg: Any , usage: ( ( String ) -> Void ) -> Void ) {
37
37
switch msg {
38
38
case CommandLineError . InvalidUsage( let hint, let mode) :
39
- perror ( " invalid usage: \( hint) " )
39
+ print ( error : " invalid usage: \( hint) " )
40
40
41
41
if isatty ( fileno ( libc. stdin) ) {
42
42
switch mode {
@@ -50,7 +50,7 @@ extension Error: CustomStringConvertible {
50
50
}
51
51
}
52
52
default :
53
- perror ( msg)
53
+ print ( error : msg)
54
54
}
55
55
56
56
exit ( 1 )
@@ -63,10 +63,11 @@ private func red(input: Any) -> String {
63
63
return CSI + " 31m " + input + CSI + " 0m "
64
64
}
65
65
66
- private func perror ( msg : Any ) {
66
+ private func print ( error error : Any ) {
67
67
if !isatty( fileno ( libc. stderr) ) {
68
- print ( " swift-build: error: " , msg, to: & stderr)
68
+ let cmd = Process . arguments. first? . basename ?? " SwiftPM "
69
+ print ( " \( cmd) : error: " , error, to: & stderr)
69
70
} else {
70
- print ( red ( " error: " ) , msg , to: & stderr)
71
+ print ( red ( " error: " ) , error , to: & stderr)
71
72
}
72
73
}
You can’t perform that action at this time.
0 commit comments