You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 45b6656
Browse filesBrowse the repository at this point in the historyBrowse files
- On Windows
- Portable mode: it stores in `data/process.lock`
- Non-portable mode: it stores in `%APPDATA%/SourceGit/process.lock`
- On macOS, it stores in `~/Library/Application Support/SourceGit/process.lock`
- On Linux
- Portable mode: it stores in `data/process.lock`
- Non-portable mode: it stores in `$XDG_RUNTIME_DIR/sourcegit.instance.lock`
Signed-off-by: leo <longshuang@msn.cn>
Copy file name to clipboardExpand all lines: src/Models/IpcChannel.cs
+66-9Lines changed: 66 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,52 @@ namespace SourceGit.Models
10
10
{
11
11
public class IpcChannel : IDisposable
12
12
{
13
-
public bool IsFirstInstance { get; }
13
+
public bool IsFirstInstance { get; private set; }
14
14
15
15
public event Action<string> MessageReceived;
16
16
17
17
public IpcChannel()
18
18
{
19
-
try
19
+
IsFirstInstance = false;
20
+
21
+
var lockFile = GetLockFilePath();
22
+
if (OperatingSystem.IsLinux() && lockFile.NeedChangePermissions)
23
+
{
24
+
// On Linux, if the lock file is created in the XDG_RUNTIME_DIR, we need to set the permissions to 700 (rwx------) to ensure that only the current user can access it.
25
+
try
26
+
{
27
+
_singletonLock = new FileStream(lockFile.Path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
0 commit comments