use fs/promise

This commit is contained in:
Ryan Kophs 2025-05-15 11:59:02 -04:00
parent 40a9f30755
commit 8d17ebc0bb
No known key found for this signature in database

View file

@ -314,8 +314,8 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe
Authorization successful! Authorization successful!
You may close this window and return to the CLI. You may close this window and return to the CLI.
<script> <script>
// If this is a non-interactive session (no manual approval step was required) then // If this is a non-interactive session (no manual approval step was required) then
// this should automatically close the window. If not, this will have no effect and // this should automatically close the window. If not, this will have no effect and
// the user will see the message above. // the user will see the message above.
window.close(); window.close();
</script> </script>
@ -431,7 +431,7 @@ export async function parseCommandLineArgs(args: string[], usage: string) {
} else if (args[i] === '--headerFile' && i < args.length - 1) { } else if (args[i] === '--headerFile' && i < args.length - 1) {
const filePath = args[i + 1] const filePath = args[i + 1]
try { try {
const fileContent = fs.readFileSync(filePath, 'utf8') const fileContent = await fs.readFile(filePath, 'utf8')
const lines = fileContent.split('\n') const lines = fileContent.split('\n')
for (const line of lines) { for (const line of lines) {
const trimmedLine = line.trim() const trimmedLine = line.trim()
@ -446,7 +446,7 @@ export async function parseCommandLineArgs(args: string[], usage: string) {
} }
log(`Loaded headers from file: ${filePath}`) log(`Loaded headers from file: ${filePath}`)
} catch (error) { } catch (error) {
log(`Error reading header file ${filePath}: ${error.message}`) log(`Error reading header file ${filePath}: ${error}`)
} }
args.splice(i, 2) args.splice(i, 2)
// Do not increment i, as the array has shifted // Do not increment i, as the array has shifted