@@ -43,6 +43,17 @@ function printStandardLibError() {
43
43
log . error ( '$ sudo apt-get install libstdc++-4.9-dev' )
44
44
}
45
45
46
+ function cleanup ( ) {
47
+ // If we're using node-libcurl from a package manager then let's clean up after
48
+ // ourselves when we install successfully - unless specified not to.
49
+ if ( ! buildFlags . mustBuild ) {
50
+ rimraf . sync ( path . join ( rootPath , 'build' ) )
51
+ if ( fs . existsSync ( path . join ( rootPath , 'curl-for-windows' ) ) ) {
52
+ rimraf . sync ( path . join ( rootPath , 'curl-for-windows' ) )
53
+ }
54
+ }
55
+ }
56
+
46
57
module . exports = function install ( ) {
47
58
if ( buildFlags . isGitRepo ) {
48
59
// If we're building NodeGit from a git repo we aren't going to do any
@@ -53,6 +64,7 @@ module.exports = function install() {
53
64
if ( buildFlags . isElectron || buildFlags . isNWjs ) {
54
65
// If we're building for electron or NWjs, we're unable to require the
55
66
// built library so we have to just assume success, unfortunately.
67
+ cleanup ( )
56
68
return Promise . resolve ( )
57
69
}
58
70
@@ -74,21 +86,7 @@ module.exports = function install() {
74
86
throw e
75
87
}
76
88
} )
77
- . then ( function ( ) {
78
- // If we're using node-libcurl from a package manager then let's clean up after
79
- // ourselves when we install successfully.
80
- if ( ! buildFlags . mustBuild ) {
81
- // We can't remove the source files yet because apparently the
82
- // "standard workflow" for native node modules in Electron/nwjs is to
83
- // build them for node and then nah eff that noise let's rebuild them
84
- // again for the actual platform! Hurray!!! When that madness is dead
85
- // we can clean up the source which is a serious amount of data.
86
- rimraf . sync ( path . join ( rootPath , 'build' ) )
87
- if ( fs . existsSync ( path . join ( rootPath , 'curl-for-windows' ) ) ) {
88
- rimraf . sync ( path . join ( rootPath , 'curl-for-windows' ) )
89
- }
90
- }
91
- } )
89
+ . then ( cleanup )
92
90
}
93
91
94
92
// Called on the command line
0 commit comments