You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by da...@apache.org on 2023/03/13 15:56:07 UTC

[daffodil-vscode] branch main updated: conditionally require wait_port

This is an automated email from the ASF dual-hosted git repository.

davin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new 1dbcd2d  conditionally require wait_port
1dbcd2d is described below

commit 1dbcd2df6a0f86d117a53868961ce3e8c0961ddf
Author: Davin Shearer <22...@users.noreply.github.com>
AuthorDate: Wed Feb 15 08:25:30 2023 -0500

    conditionally require wait_port
---
 src/tests/suite/omegaEdit.test.ts |  3 +--
 src/utils.ts                      | 12 ++++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/tests/suite/omegaEdit.test.ts b/src/tests/suite/omegaEdit.test.ts
index 27df8db..ae60f15 100644
--- a/src/tests/suite/omegaEdit.test.ts
+++ b/src/tests/suite/omegaEdit.test.ts
@@ -26,8 +26,6 @@ import * as fs from 'fs'
 import { PROJECT_ROOT, PACKAGE_PATH, TEST_SCHEMA } from './common'
 import { initOmegaEditClient } from '../../omega_edit/utils'
 
-const wait_port = require('wait-port')
-
 const omegaEditPackagePath = path.join(PROJECT_ROOT, 'node_modules/omega-edit')
 const omegaEditVersion =
   omegaEditClient.getOmegaEditPackageVersion(PACKAGE_PATH)
@@ -140,6 +138,7 @@ suite('omega-edit Test Suite', () => {
   })
 
   test('running omega-edit server', async () => {
+    const wait_port = require('wait-port')
     assert.strictEqual(
       await wait_port({ host: '127.0.0.1', port: port, output: 'silent' }),
       true
diff --git a/src/utils.ts b/src/utils.ts
index 56ff080..19efab8 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -22,8 +22,6 @@ import * as os from 'os'
 import * as child_process from 'child_process'
 import path from 'path'
 
-const wait_port = require('wait-port')
-
 const defaultConf = vscode.workspace.getConfiguration()
 let currentConfig: vscode.DebugConfiguration
 
@@ -247,9 +245,11 @@ export async function runScript(
 
   displayTerminalExitStatus(terminal)
 
-  type.includes('daffodil')
-    ? await delay(5000).then(() => {})
-    : await wait_port({ host: '127.0.0.1', port: port, output: 'silent' })
-
+  if (type.includes('daffodil')) {
+    await delay(5000).then(() => {})
+  } else {
+    const wait_port = require('wait-port')
+    await wait_port({ host: '127.0.0.1', port: port, output: 'silent' })
+  }
   return terminal
 }