Skip to content

Git does not abort push on failed clone #362

Description

@Katsute

Git clone consumes the error, causing the subsequent steps to still run when they shouldn't. Need to either rethrow or replace chained execution with await.

}catch(error: any){
if(error){
logger.error(`Push failed: ${auth.mask(String(error), cred)}`, true);
cleanup(temp);
}
}
}
})
// add files
.add(".", gitback)
// commit changes
.commit(`${version} ${config.get("includeHostnameInCommitMessage") ? `<${os.userInfo().username}@${os.hostname()}> ` : ""} Update settings repository`, gitback)
// push to remote
.push(["-u", "origin", "HEAD"], (err: GitError | null) => {
gitback(err);
if(!err){
logger.info(`Pushed settings to ${repo}@${branch}`, true);
cleanup(temp);
}
});
}catch(error: any){
logger.error(`Push failed: ${auth.mask(String(error?.message ?? error), cred)}`, true);
}finally{
cleanup(temp);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions