question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial hyper session is not created correctly

See original GitHub issue
  • I am on the latest Hyper.app version
  • I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: macOS 10.14.5
  • Hyper.app version: 3.0.2

Issue

Hi 😃 Thanks for your work on this!

I use https://github.com/hharnisc/hypercwd and noticed the following bug https://github.com/hharnisc/hypercwd/issues/71:

The problem is: The initial working directory is not set correctly for the very first hyper session, but people noticed that after a full reload the CWD was set correctly again. The issue on hypercwd seems a bit stale and nobody seems to know how to fix it, so I took a little dive into the code and this is what I found:

First: the bug does not seem to come from the hypercwd codebase, but rather from this codebase.

The problem seems to be located in the optimistically/eagerly creating an initial session here: https://github.com/zeit/hyper/blob/c13c8a5c52cbc8e02098244193a4e715fffcd902/app/ui/window.js#L140 To be more exact in createInitialSession(): https://github.com/zeit/hyper/blob/c13c8a5c52cbc8e02098244193a4e715fffcd902/app/ui/window.js#L124

Here createSession() is optimistically called without passing any parameter, although the function is defined as createSession(extraOptions = {}). Those extraOptions are used to set the CWD (among other things correctly), see: https://github.com/zeit/hyper/blob/c13c8a5c52cbc8e02098244193a4e715fffcd902/app/ui/window.js#L111

    function createSession(extraOptions = {}) {
      const uid = uuid.v4();

      const defaultOptions = Object.assign(
        {
          rows: 40,
          cols: 100,
          cwd: process.argv[1] && isAbsolute(process.argv[1]) ? process.argv[1] : homeDirectory,
          splitDirection: undefined,
          shell: cfg.shell,
          shellArgs: cfg.shellArgs && Array.from(cfg.shellArgs)
        },
        extraOptions, // <-- this is the important line
        {uid}
      );
      const options = decorateSessionOptions(defaultOptions);
      const DecoratedSession = decorateSessionClass(Session);
      const session = new DecoratedSession(options);
      sessions.set(uid, session);
      return {session, options};
    }

This optimistically creating an initial session without passing the correct extraOptions is the underlying problem for the mentioned issue. The CWD is set incorrectly, because it is not set at all. After a full reload however it is then overwritten correctly.

I am unsure about the reasoning for this optimistic session creating and whether it is a technical necessity or a performance optimization.

I tried removing https://github.com/zeit/hyper/blob/canary/app/ui/window.js#L140 this line and everything seemed to still work and the bug was fixed.

I hope this analysis provides enough insight for you to come up with a decision on how to proceed quickly as the issue really is quite annoying.

Thanks for your help, have a nice day 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8

github_iconTop GitHub Comments

4reactions
stnwkcommented, Aug 13, 2019

@chabou Friendly ping 😃 Can you please take a look at this? It’s a really annoying issue 😕 Thanks!

2reactions
libisellercommented, Aug 27, 2019

Any progress? It’s seems like an easy fix and it’s really annoying. Every extension relying on extraOptions is broken… @chabou

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hyper-V advanced session doesn't work - Microsoft Q&A
Hi to all, I have Windows 10 Pro, Remot Desktop enabled, hyper-v enabled with advanced session enabled in both the setings points:
Read more >
Hyper-V Manager "An error occurred while ... - GitHub
Unable to access Hyper V Manager after the Windows Update 1809. Getting the following error. Hyper-V Virtual Machine Management service is running properly....
Read more >
Citrix Director failure reasons and troubleshooting
Category Reason Issue None None None Configuration DisallowedProtocol The ICA and RDP protocols are not allowed.
Read more >
How to Fix the Error: Hyper-V Checkpoint Operation Failed
Here are some errors that you may encounter when trying to create a Hyper-V checkpoint: Hyper-V checkpoint operation failed; Could not initiate ...
Read more >
How to fix 8 common remote desktop connection problems
First, try to establish a session from a client that has been able to successfully connect in the past. The goal is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found