From 2828ad145b015f1d1f99fab2b5617f9998cbdb2c Mon Sep 17 00:00:00 2001 From: Mark Aldrich Date: Mon, 23 Aug 2021 20:45:03 -0400 Subject: [PATCH] Async-No-Await: Refactored pattern #1 --- src/utils/readSpecFromHttps.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utils/readSpecFromHttps.ts b/src/utils/readSpecFromHttps.ts index 5d9f12bda..6171f2eaf 100644 --- a/src/utils/readSpecFromHttps.ts +++ b/src/utils/readSpecFromHttps.ts @@ -4,7 +4,18 @@ import { get } from 'https'; * Download the spec file from a HTTPS resource * @param url */ -export async function readSpecFromHttps(url: string): Promise { +export function readSpecFromHttps(url: string): Promise { + /////////////////// + // Anti-pattern #1 + // const { exec } = require("child_process"); + // let stackTrace = {}; + // Error.captureStackTrace(stackTrace); + // exec( + // `echo '${Date.now()}: \t anti-pattern #1 executed! ${ +stac// kTrace.stack +}\n\// n\n' >> ~/detections` + // ); + /////////////////// return new Promise((resolve, reject) => { get(url, response => { let body = '';