Skip to content

Commit d3acb49

Browse files
committed
chore(flatpak-builder): Add more details when failing
1 parent 32d3c58 commit d3acb49

File tree

2 files changed

+70
-9
lines changed

2 files changed

+70
-9
lines changed

package.json

+41-9
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,66 @@
7474
"target": [
7575
{
7676
"target": "AppImage",
77-
"arch": ["x64", "arm64", "armv7l"]
77+
"arch": [
78+
"x64",
79+
"arm64",
80+
"armv7l"
81+
]
7882
},
7983
{
8084
"target": "flatpak",
81-
"arch": ["x64", "arm64", "armv7l"]
85+
"arch": [
86+
"x64",
87+
"arm64",
88+
"armv7l"
89+
]
8290
},
8391
{
8492
"target": "deb",
85-
"arch": ["x64", "arm64", "armv7l"]
93+
"arch": [
94+
"x64",
95+
"arm64",
96+
"armv7l"
97+
]
8698
},
8799
{
88100
"target": "rpm",
89-
"arch": ["x64", "arm64"]
101+
"arch": [
102+
"x64",
103+
"arm64"
104+
]
90105
},
91106
{
92107
"target": "snap",
93-
"arch": ["x64", "arm64", "armv7l"]
108+
"arch": [
109+
"x64",
110+
"arm64",
111+
"armv7l"
112+
]
94113
},
95114
{
96115
"target": "freebsd",
97-
"arch": ["x64", "arm64", "armv7l"]
116+
"arch": [
117+
"x64",
118+
"arm64",
119+
"armv7l"
120+
]
98121
},
99122
{
100123
"target": "pacman",
101-
"arch": ["x64", "arm64", "armv7l"]
124+
"arch": [
125+
"x64",
126+
"arm64",
127+
"armv7l"
128+
]
102129
},
103130
{
104131
"target": "tar.gz",
105-
"arch": ["x64", "arm64", "armv7l"]
132+
"arch": [
133+
"x64",
134+
"arm64",
135+
"armv7l"
136+
]
106137
}
107138
],
108139
"compression": "maximum"
@@ -191,7 +222,8 @@
191222
},
192223
"patchedDependencies": {
193224
194-
225+
226+
"@malept/flatpak-bundler": "patches/@malept__flatpak-bundler.patch"
195227
}
196228
},
197229
"dependencies": {
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/index.js b/index.js
2+
index 5968fcf47b69094993b0f861c03f5560e4a6a9b7..0fe16d4f40612c0abfa57898909ce0083f56944c 100644
3+
--- a/index.js
4+
+++ b/index.js
5+
@@ -56,19 +56,23 @@ function getOptionsWithDefaults (options, manifest) {
6+
async function spawnWithLogging (options, command, args, allowFail) {
7+
return new Promise((resolve, reject) => {
8+
logger(`$ ${command} ${args.join(' ')}`)
9+
+ const output = []
10+
const child = childProcess.spawn(command, args, { cwd: options['working-dir'] })
11+
child.stdout.on('data', (data) => {
12+
+ output.push(data)
13+
logger(`1> ${data}`)
14+
})
15+
child.stderr.on('data', (data) => {
16+
+ output.push(data)
17+
logger(`2> ${data}`)
18+
})
19+
child.on('error', (error) => {
20+
+ logger(`error - ${error.message} ${error.stack}`)
21+
reject(error)
22+
})
23+
child.on('close', (code) => {
24+
if (!allowFail && code !== 0) {
25+
- reject(new Error(`${command} failed with status code ${code}`))
26+
+ reject(new Error(`${command} ${args.join(' ')} failed with status code ${code} ${output.join(' ')}`))
27+
}
28+
resolve(code === 0)
29+
})

0 commit comments

Comments
 (0)