mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
use fstatSync instead of statSync
This commit is contained in:
parent
46db4850df
commit
dad3602d2b
2 changed files with 9 additions and 4 deletions
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -654,9 +654,7 @@ class GitAuthHelper {
|
|||
if (this.gitConfigPath.length === 0) {
|
||||
this.gitConfigPath = yield this.git.getGitPath('config');
|
||||
}
|
||||
console.log(this.gitConfigPath);
|
||||
let content = (yield fs.promises.readFile(this.gitConfigPath)).toString();
|
||||
console.log(content);
|
||||
const index = content.indexOf(find);
|
||||
if (index < 0 || index != content.lastIndexOf(find)) {
|
||||
throw new Error(`Unable to replace '${find}' in ${this.gitConfigPath}`);
|
||||
|
@ -1413,9 +1411,10 @@ function fileExistsSync(path) {
|
|||
if (!path) {
|
||||
throw new Error("Arg 'path' must not be empty");
|
||||
}
|
||||
const fd = fs.openSync(path, 'r');
|
||||
let stats;
|
||||
try {
|
||||
stats = fs.statSync(path);
|
||||
stats = fs.fstatSync(fd);
|
||||
}
|
||||
catch (error) {
|
||||
if (hasErrorCode(error) && error.code === 'ENOENT') {
|
||||
|
@ -1423,6 +1422,9 @@ function fileExistsSync(path) {
|
|||
}
|
||||
throw new Error(`Encountered an error when checking whether path '${path}' exists: ${getErrorMessage(error)}`);
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
if (!stats.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue