Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 085e38d

Browse files
committed
Added error handling
1 parent 2a9db83 commit 085e38d

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

dist/index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13636,10 +13636,22 @@ class se_Helper {
1363613636
createMetaJson(root) {
1363713637
const execSync = external_child_process_.execSync;
1363813638
console.log('Run number: ' + this.currentBuild.runNumber);
13639-
const xmllint = execSync('sudo apt install libxml2-utils', {
13640-
shell: '/bin/bash'
13641-
});
13642-
console.log(xmllint.toString());
13639+
try {
13640+
const xmllint = execSync('sudo apt install libxml2-utils', {
13641+
shell: '/bin/bash'
13642+
});
13643+
console.log(xmllint.toString());
13644+
}
13645+
catch (err) {
13646+
let message;
13647+
if (err instanceof Error) {
13648+
message = err.message;
13649+
}
13650+
else {
13651+
message = String(err);
13652+
}
13653+
console.log(message);
13654+
}
1364313655
const ret = [];
1364413656
const poms = this.listPoms(root);
1364513657
const ownersFile = Object(external_fs_.readFileSync)(root + '.github/CODEOWNERS', 'utf8')

src/se.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,21 @@ export class Helper {
4646
public createMetaJson(root: string) {
4747
const execSync = child.execSync
4848
console.log('Run number: ' + this.currentBuild.runNumber)
49-
const xmllint = execSync('sudo apt install libxml2-utils', {
50-
shell: '/bin/bash'
51-
})
52-
console.log(xmllint.toString())
49+
try {
50+
const xmllint = execSync('sudo apt install libxml2-utils', {
51+
shell: '/bin/bash'
52+
})
53+
54+
console.log(xmllint.toString())
55+
} catch (err) {
56+
let message
57+
if (err instanceof Error) {
58+
message = err.message
59+
} else {
60+
message = String(err)
61+
}
62+
console.log(message)
63+
}
5364
const ret: string[] = []
5465
const poms = this.listPoms(root)
5566
const ownersFile = fs

0 commit comments

Comments
 (0)