src/utils/haulPortHandler.js
function isPortTaken(port: number): Promise<boolean> {
  return new Promise(resolve => {
    const portTester = net
      .createServer()
      .once('error', () => {
        return resolve(true);
      })
      .once('listening', () => {
        portTester.close();
        resolve(false);
      })
      .listen(port);
  });
}
function isPortTaken(port: number): Promise<boolean> {
  return new Promise(resolve => {
    const portTester = net
      .createServer()
      .once('error', () => {
        return resolve(true);
      })
      .once('listening', () => {
        portTester.close();
        resolve(false);
      })
      .listen(port);
  });
}
/*
Check if the port is already in use