[GH-ISSUE #903] home dir error #523

Closed
opened 2026-02-26 23:59:50 +03:00 by kerem · 3 comments
Owner

Originally created by @blue-bird1 on GitHub (Nov 13, 2018).
Original GitHub issue: https://github.com/electerm/electerm/issues/903

Electerm version:

0.25.21

Operating system(linux, macos, or windows?):

windows

Expected Behavior

localshell in home dir .

Current Behavior

localshell in download electerm dir

Possible Solution

diff --git a/app/lib/terminal.js b/app/lib/terminal.js
index 4e4d25b..5360c2e 100644
--- a/app/lib/terminal.js
+++ b/app/lib/terminal.js
@@ -27,11 +27,12 @@ class Terminal {
     let {platform} = process
     let exe = platform.startsWith('win') ? 'powershell.exe' : 'bash'
     let argv = platform.startsWith('darwin') ? ['--login'] : []
+    let home = platform.startsWith('win') ? process.env.USERPROFILE : process.env.HOME
     this.term = pty.spawn(exe, argv, {
       name: 'xterm-color',
       cols: cols || 80,
       rows: rows || 24,
-      cwd: process.env.HOME,
+      cwd: home,
       env: process.env
     })
     return Promise.resolve()

Steps to Reproduce

Context (Environment)

Detailed Description

Suggestions?

windows not have process.env.HOME, but have process.env.USERPROFILE :

Originally created by @blue-bird1 on GitHub (Nov 13, 2018). Original GitHub issue: https://github.com/electerm/electerm/issues/903 <!--- Provide some basic info --> ## Electerm version: 0.25.21 ## Operating system(linux, macos, or windows?): windows ## Expected Behavior <!--- Tell me what should happen --> localshell in home dir . ## Current Behavior <!--- Tell me what happens instead of the expected behavior --> localshell in download electerm dir ## Possible Solution <!--- Not obligatory, but suggest a fix/reason for the bug, --> ``` diff --git a/app/lib/terminal.js b/app/lib/terminal.js index 4e4d25b..5360c2e 100644 --- a/app/lib/terminal.js +++ b/app/lib/terminal.js @@ -27,11 +27,12 @@ class Terminal { let {platform} = process let exe = platform.startsWith('win') ? 'powershell.exe' : 'bash' let argv = platform.startsWith('darwin') ? ['--login'] : [] + let home = platform.startsWith('win') ? process.env.USERPROFILE : process.env.HOME this.term = pty.spawn(exe, argv, { name: 'xterm-color', cols: cols || 80, rows: rows || 24, - cwd: process.env.HOME, + cwd: home, env: process.env }) return Promise.resolve() ``` ## Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug. Include code to reproduce, if relevant --> 1. 2. 3. 4. ## Context (Environment) <!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world --> ## Detailed Description <!--- Provide a detailed description of the change or addition you are proposing --> ## Suggestions? <!--- Not a bug report, just some thoughts or suggestions? It is totally OK and welcome too --> windows not have process.env.HOME, but have process.env.USERPROFILE :
kerem 2026-02-26 23:59:50 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@zxdong262 commented on GitHub (Nov 13, 2018):

@blue-bird1 Thanks, I will try.

<!-- gh-comment-id:438324045 --> @zxdong262 commented on GitHub (Nov 13, 2018): @blue-bird1 Thanks, I will try.
Author
Owner

@blue-bird1 commented on GitHub (Nov 13, 2018):

@zxdong262 How should I only build a Windows package in Linux

<!-- gh-comment-id:438339611 --> @blue-bird1 commented on GitHub (Nov 13, 2018): @zxdong262 How should I only build a Windows package in Linux
Author
Owner

@zxdong262 commented on GitHub (Nov 14, 2018):

@blue-bird1 Possible by using wine, or some pre-built docker image, I did build some simpler windows app in linux, but electerm is more complicated, too much trouble I guess, so I use appveyor to do the build.

<!-- gh-comment-id:438510815 --> @zxdong262 commented on GitHub (Nov 14, 2018): @blue-bird1 Possible by using wine, or some pre-built docker image, I did build some simpler windows app in linux, but electerm is more complicated, too much trouble I guess, so I use appveyor to do the build.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#523
No description provided.