Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting process directory not respected when program uses alternate screen buffers #1402

Closed
Maximus5 opened this issue Jul 31, 2015 · 2 comments

Comments

@Maximus5
Copy link
Owner

Originally reported on Google Code with ID 1402

OS version: Win7  SP1   x64
ConEmu version: 131219 x64
Far version (if you are using Far Manager): none

*Bug description*
Processes started under ConEmuC that use CreateConsoleScreenBuffer/SetConsoleActiveScreenBuffer
have their current working directory warped to the folder containing the program executable.

*Steps to reproduction*
1. Compile and run the test screen buffer program sb.c (attached), e.g. cl /Zi sb.c
2. Change directory to C:\
3. Run the sb.exe program from where it was built
4. Observe the program's reported current directory at startup
5. Running the test outside of ConEmu results in C:\
6. Running the test under ConEmu results in folder that contains sb.exe

Proposed commit to fix the bug:

https://github.com/ricksladkey/ConEmu/commit/9006f4942a3820f0478fdc597580d76dc091c90a

Proposed patch to src/ConEmuCD/ConsoleMain.cpp:

diff --git a/src/ConEmuCD/ConsoleMain.cpp b/src/ConEmuCD/ConsoleMain.cpp
index 57679a5..628cd84 100644
--- a/src/ConEmuCD/ConsoleMain.cpp
+++ b/src/ConEmuCD/ConsoleMain.cpp
@@ -1497,7 +1497,7 @@ int __stdcall ConsoleMain2(int anWorkMode/*0-Server&ComSpec,1-AltServer,2-Reserv
    /* ************************ */

    // ×òîáû íå áëîêèðîâàòü ïàïêó çàïóñêà
-   if (szSelfDir[0])
+   if (gnRunMode != RM_ALTSERVER && szSelfDir[0])
        SetCurrentDirectory(szSelfDir);

    if (gnRunMode == RM_SERVER)
@@ -1625,7 +1625,7 @@ wait:


    // ×òîáû íå áëîêèðîâàòü ïàïêó çàïóñêà (íà âñÿêèé ñëó÷àé, åñëè íà ìåòêó goto áûë)
-   if (szSelfDir[0])
+   if (gnRunMode != RM_ALTSERVER && szSelfDir[0])
        SetCurrentDirectory(szSelfDir);



Reported by rick.sladkey on 2013-12-22 05:58:31


- _Attachment: [sb.c](https://storage.googleapis.com/google-code-attachments/conemu-maximus5/issue-1402/comment-0/sb.c)_
@Maximus5 Maximus5 self-assigned this Jul 31, 2015
@Maximus5
Copy link
Owner Author

Reported by ConEmu.Maximus5 on 2013-12-22 13:22:00

  • Status changed: Accepted

@Maximus5
Copy link
Owner Author

Reported by ConEmu.Maximus5 on 2013-12-24 08:21:49

  • Status changed: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant