bugDotGNU Portable.NET - Bugs: bug #15098, Process.StartInfo.WorkingDirectory...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #15098: Process.StartInfo.WorkingDirectory does not work

Submitter:  Radek Polak <radekp>
Submitted:  Tue 29 Nov 2005 06:47:02 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Sat 03 Dec 2005 11:12:27 AM UTC, comment #1: 

committed to cvs 2005-12-03, Klaus

Klaus Treichel <ktreichel>
Group administrator
Tue 29 Nov 2005 06:47:02 PM UTC, original submission:  

Hello,

This patch implements/fixes Process.StartInfo.WorkingDirectory parameter and fixes some other related problems.

I have added workingDir parameter to StartProcess() internal call. This means, that applying this patch involves:

- patch Process.cs
- rebuild pnetlib
- run mkint.sh in pnet/engine
- patch lib_task.c
- commit

Things that have been done:

1) Fixed obvious typo in Process.cs line 915. Path.PathSeparator was used to combine path, whitch is invalid because it is char ':'. Path.Combine() or Path.DirectorySeparator should be used instead.

2) WorkingDirectory is implemented to behave the same way as in .NET. I had to write a test programs to find out the behaviour, because MSDN documentation does not correspond to .NET implementation (and according to these documents, WorkingDirectory would be quite useless). Implementation behaves now like following:

a) WorkingDirectory is always directory where the new process is started - figures as CurrentDirectory in started process

b) if(UseShellExecute==true && FileName is realative path)
   {
        combine WorkingDirectory + Filename and start process from that location.
   }

c) if(UseShellExecute==false)
   {
        directly start process where FileName points to executable location (do not combine WorkingDirectory and FileName)
   }

3) There was added a line to clear errno in the beginning of cygwin part for _IL_Process_StartProcess(). Errno was hanging there from some previous operation e.g. from ILFileExists(). This caused that checking for Errno always threw exception (Process.cs line 946).

4) Above mentioned checking for Errno is now done conditionaly - only when _IL_Process_StartProcess() returns false. (Did it make sense to check for error if that function returned success?)

5) Added passing of workingDir parameter to CreateProcess (cygwin part). Added ILChangeDir() to switch current directory in forked process (linux).

I've also attached simple test program, that prints process start parameters, and start process that prints it's current directory (standard pwd program for unices, message box with current dir for windows).

Patch works for me on gentoo/cygwin though I will do some more testing tommorow, because i had to finnish it in time pressure.

Thanks to KlausT and MarcusU for help.

Radek Polak <radekp>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #2569:  Process_WorkingDir.tar.gz added by radekp (14KiB - application/x-tgz - patches and test program)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-12-03 ktreichel StatusNone Fixed
    Open/ClosedOpen Closed
2005-11-29 radekp Attached File- Added Process_WorkingDir.tar.gz, #3145

Back to the top

Powered by Savane 3.13-caa5.
Corresponding source code