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

Submitted by:  Radek Polak <radekp>
Submitted on:  Tue 29 Nov 2005 06:47:02 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned 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>
Project 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>
Project Member

 

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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 03 Dec 2005 11:12:27 AM UTCktreichelStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Tue 29 Nov 2005 06:47:02 PM UTCradekpAttached File-=>Added Process_WorkingDir.tar.gz, #3145

Back to the top


Powered by Savane 3.1-cleanup1